-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement an AppContext compatibility switch re-enabling reflection f…
…allback in STJ source generators. (#75615) * Implement an AppContext compatibility switch re-enabling reflection fallback in sourcegen. * address feedback
- Loading branch information
1 parent
403b05c
commit 6b2349a
Showing
4 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/libraries/System.Text.Json/src/System/Text/Json/AppContextSwitchHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Text.Json | ||
{ | ||
internal static class AppContextSwitchHelper | ||
{ | ||
public static bool IsSourceGenReflectionFallbackEnabled => s_isSourceGenReflectionFallbackEnabled; | ||
|
||
private static readonly bool s_isSourceGenReflectionFallbackEnabled = | ||
AppContext.TryGetSwitch( | ||
switchName: "System.Text.Json.Serialization.EnableSourceGenReflectionFallback", | ||
isEnabled: out bool value) | ||
? value : false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters