@@ -270,33 +270,9 @@ async Task<OutputData<string>> GetData()
270
270
271
271
// This needs to handle nested potentially secret and unknown Output values, we do this by
272
272
// hooking options to handle any seen Output<T> values.
273
-
274
- // TODO: This can be simplified in net6.0 to just new System.Text.Json.JsonSerializerOptions(options);
275
- #if NETCOREAPP3_1
276
- var internalOptions = new System . Text . Json . JsonSerializerOptions ( ) ;
277
- internalOptions . AllowTrailingCommas = options ? . AllowTrailingCommas ?? internalOptions . AllowTrailingCommas ;
278
- if ( options != null )
279
- {
280
- foreach ( var converter in options . Converters )
281
- {
282
- internalOptions . Converters . Add ( converter ) ;
283
- }
284
- }
285
- internalOptions . DefaultBufferSize = options ? . DefaultBufferSize ?? internalOptions . DefaultBufferSize ;
286
- internalOptions . DictionaryKeyPolicy = options ? . DictionaryKeyPolicy ?? internalOptions . DictionaryKeyPolicy ;
287
- internalOptions . Encoder = options ? . Encoder ?? internalOptions . Encoder ;
288
- internalOptions . IgnoreNullValues = options ? . IgnoreNullValues ?? internalOptions . IgnoreNullValues ;
289
- internalOptions . IgnoreReadOnlyProperties = options ? . IgnoreReadOnlyProperties ?? internalOptions . IgnoreReadOnlyProperties ;
290
- internalOptions . MaxDepth = options ? . MaxDepth ?? internalOptions . MaxDepth ;
291
- internalOptions . PropertyNameCaseInsensitive = options ? . PropertyNameCaseInsensitive ?? internalOptions . PropertyNameCaseInsensitive ;
292
- internalOptions . PropertyNamingPolicy = options ? . PropertyNamingPolicy ?? internalOptions . PropertyNamingPolicy ;
293
- internalOptions . ReadCommentHandling = options ? . ReadCommentHandling ?? internalOptions . ReadCommentHandling ;
294
- internalOptions . WriteIndented = options ? . WriteIndented ?? internalOptions . WriteIndented ;
295
- #else
296
273
var internalOptions = options == null ?
297
274
new System . Text . Json . JsonSerializerOptions ( ) :
298
275
new System . Text . Json . JsonSerializerOptions ( options ) ;
299
- #endif
300
276
301
277
// Add the magic converter to allow us to do nested outputs
302
278
var outputConverter = new OutputJsonConverter ( result . Resources , result . IsSecret ) ;
@@ -341,31 +317,9 @@ async Task<OutputData<T>> GetData()
341
317
return new OutputData < T > ( result . Resources , default ! , false , result . IsSecret ) ;
342
318
}
343
319
344
- #if NETCOREAPP3_1
345
- var internalOptions = new System . Text . Json . JsonSerializerOptions ( ) ;
346
- internalOptions . AllowTrailingCommas = options ? . AllowTrailingCommas ?? internalOptions . AllowTrailingCommas ;
347
- if ( options != null )
348
- {
349
- foreach ( var converter in options . Converters )
350
- {
351
- internalOptions . Converters . Add ( converter ) ;
352
- }
353
- }
354
- internalOptions . DefaultBufferSize = options ? . DefaultBufferSize ?? internalOptions . DefaultBufferSize ;
355
- internalOptions . DictionaryKeyPolicy = options ? . DictionaryKeyPolicy ?? internalOptions . DictionaryKeyPolicy ;
356
- internalOptions . Encoder = options ? . Encoder ?? internalOptions . Encoder ;
357
- internalOptions . IgnoreNullValues = options ? . IgnoreNullValues ?? internalOptions . IgnoreNullValues ;
358
- internalOptions . IgnoreReadOnlyProperties = options ? . IgnoreReadOnlyProperties ?? internalOptions . IgnoreReadOnlyProperties ;
359
- internalOptions . MaxDepth = options ? . MaxDepth ?? internalOptions . MaxDepth ;
360
- internalOptions . PropertyNameCaseInsensitive = options ? . PropertyNameCaseInsensitive ?? internalOptions . PropertyNameCaseInsensitive ;
361
- internalOptions . PropertyNamingPolicy = options ? . PropertyNamingPolicy ?? internalOptions . PropertyNamingPolicy ;
362
- internalOptions . ReadCommentHandling = options ? . ReadCommentHandling ?? internalOptions . ReadCommentHandling ;
363
- internalOptions . WriteIndented = options ? . WriteIndented ?? internalOptions . WriteIndented ;
364
- #else
365
320
var internalOptions = options == null ?
366
321
new System . Text . Json . JsonSerializerOptions ( ) :
367
322
new System . Text . Json . JsonSerializerOptions ( options ) ;
368
- #endif
369
323
370
324
// Add the magic converter to allow us to do nested outputs
371
325
var outputConverter = new OutputJsonConverter ( result . Resources , result . IsSecret ) ;
0 commit comments