9
9
using Microsoft . Extensions . Configuration ;
10
10
using Microsoft . Extensions . Logging ;
11
11
using Newtonsoft . Json ;
12
+ using Newtonsoft . Json . Linq ;
12
13
using OmniSharp . Endpoint ;
13
14
using OmniSharp . Mef ;
14
15
using OmniSharp . Models . UpdateBuffer ;
@@ -160,6 +161,11 @@ public void Start()
160
161
}
161
162
catch ( Exception e )
162
163
{
164
+ if ( e is AggregateException aggregateEx )
165
+ {
166
+ e = aggregateEx . Flatten ( ) . InnerException ;
167
+ }
168
+
163
169
_writer . WriteLine ( new EventPacket ( )
164
170
{
165
171
Event = "error" ,
@@ -218,6 +224,11 @@ private async Task HandleRequest(string json, ILogger logger)
218
224
}
219
225
catch ( Exception e )
220
226
{
227
+ if ( e is AggregateException aggregateEx )
228
+ {
229
+ e = aggregateEx . Flatten ( ) . InnerException ;
230
+ }
231
+
221
232
// updating the response object here so that the ResponseStream
222
233
// prints the latest state when being closed
223
234
response . Success = false ;
@@ -241,7 +252,7 @@ void LogRequest(string json, ILogger logger)
241
252
try
242
253
{
243
254
builder . AppendLine ( "************ Request ************" ) ;
244
- builder . Append ( json ) ;
255
+ builder . Append ( JToken . Parse ( json ) . ToString ( Formatting . Indented ) ) ;
245
256
logger . LogDebug ( builder . ToString ( ) ) ;
246
257
}
247
258
finally
@@ -256,7 +267,7 @@ void LogResponse(string json, ILogger logger)
256
267
try
257
268
{
258
269
builder . AppendLine ( "************ Response ************ " ) ;
259
- builder . Append ( json ) ;
270
+ builder . Append ( JToken . Parse ( json ) . ToString ( Formatting . Indented ) ) ;
260
271
logger . LogDebug ( builder . ToString ( ) ) ;
261
272
}
262
273
finally
0 commit comments