You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,9 +35,26 @@
35
35
36
36
To leverage them, make sure to bump your C# language version. You can do this by setting the `<LangVersion>` MSBuild property in your project. For instance, by adding `<LangVersion>11.0</LangVersion>` (or your desired C# version) to the first `<PropertyGroup>` of your .csproj file. For more info on this, [see here](https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb), but remember that you don't need to manually copy polyfills anymore: simply adding a reference to **PolySharp** will do this for you automatically.
37
37
38
+
It also includes the following optional runtime-supported polyfills:
39
+
- Reflection annotation attributes (see [docs](https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming)):
40
+
-`[DynamicallyAccessedMembers]`
41
+
-`[DynamicDependency]`
42
+
-`[RequiresUnreferencedCode]`
43
+
-`[UnconditionalSuppressMessage]`
44
+
-`[StackTraceHidden]` (see [here](https://makolyte.com/csharp-exclude-exception-throw-helper-methods-from-the-stack-trace/))
45
+
-`[UnmanagedCallersOnly]` (see [docs](https://learn.microsoft.com/dotnet/api/system.runtime.interopservices.unmanagedcallersonlyattribute)))
46
+
- Platform support annotation attributes (see [docs](https://learn.microsoft.com/dotnet/standard/analyzers/platform-compat-analyzer)):
47
+
-`[ObsoletedOSPlatform]`
48
+
-`[SupportedOSPlatform]`
49
+
-`[SupportedOSPlatformGuard]`
50
+
-`[TargetPlatform]`
51
+
-`[UnsupportedOSPlatform]`
52
+
-`[UnsupportedOSPlatformGuard]`
53
+
38
54
# Options ⚙️
39
55
40
56
**PolySharp**'s generation can be configured through some MSBuild properties to set in consuming projects.
41
57
42
58
The following properties are available:
43
59
- "PolySharpUsePublicAccessibilityForGeneratedTypes": changes the accessibility of generated types from `internal` to `public`.
60
+
- "PolySharpIncludeRuntimeSupportedAttributes": enables polyfills for (dummy) runtime-supported attributes too.
0 commit comments