@@ -39,7 +39,7 @@ public IDisposable ParseBeginScope<T>(T state)
3939 scopePropertyList = ParseScopeProperties ( scopePropertyList ) ;
4040 return ScopeContext . PushNestedStateProperties ( scopeObject , scopePropertyList ) ;
4141 }
42- #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER || NET471_OR_GREATER
42+ #if NETSTANDARD2_1_OR_GREATER || NET || NET471_OR_GREATER
4343 else if ( state is System. Runtime. CompilerServices. ITuple && ( ( System . Runtime . CompilerServices . ITuple ) state) . Length = = 2 && ( ( System . Runtime . CompilerServices . ITuple ) state ) [ 0 ] is string propertyName )
4444 {
4545 return ScopeContext . PushProperty ( propertyName , ( ( System . Runtime . CompilerServices . ITuple ) state ) [ 1 ] ) ;
@@ -239,7 +239,7 @@ public static IDisposable CaptureScopeProperty<TState>(TState scopeProperty, Ext
239239 private static bool TryLookupExtractor < TState > ( ExtractorDictionary stateExtractor , TState propertyValue ,
240240 out Func < object , KeyValuePair < string , object ? > > ? keyValueExtractor )
241241 {
242- #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER || NET471_OR_GREATER
242+ #if NETSTANDARD2_1_OR_GREATER || NET || NET471_OR_GREATER
243243 if ( propertyValue is System . Runtime . CompilerServices . ITuple && ( ( System . Runtime . CompilerServices . ITuple ) propertyValue ) . Length == 2 && ( ( System . Runtime . CompilerServices . ITuple ) propertyValue ) [ 0 ] is string )
244244 {
245245 keyValueExtractor = static ( obj ) => new KeyValuePair < string , object ? > (
@@ -283,7 +283,7 @@ private static bool TryBuildExtractor(Type propertyType, out Func<object, KeyVal
283283 return keyValueExtractor != null ;
284284 }
285285
286- #if ! NETSTANDARD2_1_OR_GREATER && ! NETCOREAPP3_1_OR_GREATER && ! NET471_OR_GREATER
286+ #if ! NETSTANDARD2_1_OR_GREATER && ! NET && ! NET471_OR_GREATER
287287 if ( propertyType . GetGenericTypeDefinition ( ) == typeof ( ValueTuple < , > ) )
288288 {
289289 var itemType = propertyType . GetTypeInfo ( ) ;
@@ -306,13 +306,15 @@ private static bool TryBuildExtractor(Type propertyType, out Func<object, KeyVal
306306 return false ;
307307 }
308308
309- #if ! NETSTANDARD && ! NETFRAMEWORK
309+ #if NETSTANDARD2_1_OR_GREATER || NET
310310 private static KeyValuePair < string , object ? > TypedKeyValueExtractor < TKey , TValue > ( object value )
311311 {
312312 var keyValuePair = ( KeyValuePair < TKey , TValue > ) value ;
313313 return new KeyValuePair < string , object ? > ( keyValuePair . Key ? . ToString ( ) ?? string . Empty , keyValuePair . Value ) ;
314314 }
315+ #endif
315316
317+ #if NET
316318 [ System . Diagnostics . CodeAnalysis . UnconditionalSuppressMessage ( "Trimming - Allow reflection of BeginScope args" , "IL2070" ) ]
317319#endif
318320 private static Func < object , KeyValuePair < string , object ? > > ? BuildKeyValueExtractor ( Type propertyType , TypeInfo itemType )
@@ -331,10 +333,7 @@ private static bool TryBuildExtractor(Type propertyType, out Func<object, KeyVal
331333
332334 private static Func < object , KeyValuePair < string , object ? > > ? BuildKeyValueExtractor ( Type propertyType )
333335 {
334- #if NETSTANDARD || NETFRAMEWORK
335- var itemType = propertyType . GetTypeInfo ( ) ;
336- return BuildKeyValueExtractor ( propertyType , itemType ) ;
337- #else
336+ #if NETSTANDARD2_1_OR_GREATER || NET
338337 if ( propertyType . GenericTypeArguments [ 0 ] == typeof ( string ) )
339338 {
340339 if ( propertyType . GenericTypeArguments [ 1 ] == typeof ( object ) )
@@ -363,8 +362,10 @@ private static bool TryBuildExtractor(Type propertyType, out Func<object, KeyVal
363362 var itemType = propertyType . GetTypeInfo ( ) ;
364363 return BuildKeyValueExtractor ( propertyType , itemType ) ;
365364 }
366-
367365 return null ;
366+ #else
367+ var itemType = propertyType . GetTypeInfo ( ) ;
368+ return BuildKeyValueExtractor ( propertyType , itemType ) ;
368369#endif
369370 }
370371
0 commit comments