-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Annotate Serilog.Settings.Configuration as not trim-compatible
Unfortunately I don't have any good news for this library. It looks like the fundamental concept, loading arbitrary types by name from arbitrary assemblies, configured by the user at run-time, is fundamentally incompatible with trimming and AOT. This at least marks it as such. Supporting a feature set like the one provided here would likely require a source generator, or build-time code generation phase.
- Loading branch information
Showing
9 changed files
with
183 additions
and
8 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
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
85 changes: 85 additions & 0 deletions
85
...ilog.Settings.Configuration/Settings/Configuration/DynamicallyAccessedMembersAttribute.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,85 @@ | ||
|
||
#if !NET6_0_OR_GREATER | ||
namespace System.Diagnostics.CodeAnalysis | ||
{ | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)] | ||
internal sealed class DynamicallyAccessedMembersAttribute : Attribute | ||
{ | ||
public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes) | ||
{ | ||
MemberTypes = memberTypes; | ||
} | ||
|
||
public DynamicallyAccessedMemberTypes MemberTypes { get; } | ||
} | ||
|
||
[Flags] | ||
internal enum DynamicallyAccessedMemberTypes | ||
{ | ||
// | ||
// Summary: | ||
// Specifies all members. | ||
All = -1, | ||
// | ||
// Summary: | ||
// Specifies no members. | ||
None = 0, | ||
// | ||
// Summary: | ||
// Specifies the default, parameterless public constructor. | ||
PublicParameterlessConstructor = 1, | ||
// | ||
// Summary: | ||
// Specifies all public constructors. | ||
PublicConstructors = 3, | ||
// | ||
// Summary: | ||
// Specifies all non-public constructors. | ||
NonPublicConstructors = 4, | ||
// | ||
// Summary: | ||
// Specifies all public methods. | ||
PublicMethods = 8, | ||
// | ||
// Summary: | ||
// Specifies all non-public methods. | ||
NonPublicMethods = 16, | ||
// | ||
// Summary: | ||
// Specifies all public fields. | ||
PublicFields = 32, | ||
// | ||
// Summary: | ||
// Specifies all non-public fields. | ||
NonPublicFields = 64, | ||
// | ||
// Summary: | ||
// Specifies all public nested types. | ||
PublicNestedTypes = 128, | ||
// | ||
// Summary: | ||
// Specifies all non-public nested types. | ||
NonPublicNestedTypes = 256, | ||
// | ||
// Summary: | ||
// Specifies all public properties. | ||
PublicProperties = 512, | ||
// | ||
// Summary: | ||
// Specifies all non-public properties. | ||
NonPublicProperties = 1024, | ||
// | ||
// Summary: | ||
// Specifies all public events. | ||
PublicEvents = 2048, | ||
// | ||
// Summary: | ||
// Specifies all non-public events. | ||
NonPublicEvents = 4096, | ||
// | ||
// Summary: | ||
// Specifies all interfaces implemented by the type. | ||
Interfaces = 8192 | ||
} | ||
} | ||
#endif |
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/Serilog.Settings.Configuration/Settings/Configuration/RequiresDynamicCode.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 @@ | ||
#if !NET6_0_OR_GREATER | ||
|
||
namespace System.Diagnostics.CodeAnalysis | ||
{ | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)] | ||
internal sealed class RequiresDynamicCodeAttribute : Attribute | ||
{ | ||
public RequiresDynamicCodeAttribute(string message) | ||
{ | ||
Message = message; | ||
} | ||
|
||
public string Message { get; } | ||
} | ||
} | ||
#endif |
16 changes: 16 additions & 0 deletions
16
...erilog.Settings.Configuration/Settings/Configuration/RequiresUnreferencedCodeAttribute.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 @@ | ||
|
||
#if !NET5_0_OR_GREATER | ||
namespace System.Diagnostics.CodeAnalysis | ||
{ | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)] | ||
internal sealed class RequiresUnreferencedCodeAttribute : Attribute | ||
{ | ||
public RequiresUnreferencedCodeAttribute(string message) | ||
{ | ||
Message = message; | ||
} | ||
|
||
public string Message { get; } | ||
} | ||
} | ||
#endif |
Oops, something went wrong.