Skip to content

Commit

Permalink
Make JsonSerializer work when IsDynamicCodeSupported is false. (#54027)
Browse files Browse the repository at this point in the history
Use the non-Emit codepath if IsDynamicCodeSupported is false.
  • Loading branch information
eerhardt committed Jun 14, 2021
1 parent 469db3d commit 49fa010
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,12 @@ internal MemberAccessor MemberAccessorStrategy
{
if (_memberAccessorStrategy == null)
{
#if NETFRAMEWORK || NETCOREAPP
#if NETCOREAPP
// if dynamic code isn't supported, fallback to reflection
_memberAccessorStrategy = RuntimeFeature.IsDynamicCodeSupported ?
new ReflectionEmitMemberAccessor() :
new ReflectionMemberAccessor();
#elif NETFRAMEWORK
_memberAccessorStrategy = new ReflectionEmitMemberAccessor();
#else
_memberAccessorStrategy = new ReflectionMemberAccessor();
Expand Down

0 comments on commit 49fa010

Please sign in to comment.