diff --git a/PolySharp.slnx b/PolySharp.slnx index ffda3b4..3b5474c 100644 --- a/PolySharp.slnx +++ b/PolySharp.slnx @@ -8,6 +8,7 @@ + diff --git a/README.md b/README.md index 3e65b86..f0014cd 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ It also includes the following optional runtime-supported polyfills: The following properties are available: - "PolySharpUsePublicAccessibilityForGeneratedTypes": makes all generated types public. +- "PolySharpUseEmbeddedAttributeForGeneratedTypes": adds the `[Embedded]` attributes to generated pofylill types. - "PolySharpIncludeRuntimeSupportedAttributes": enables polyfills for (dummy) runtime-supported attributes too. - "PolySharpUseInteropServices2NamespaceForUnmanagedCallersOnlyAttribute": moves `[UnmanagedCallersOnly]`. - "PolySharpExcludeGeneratedTypes": excludes specific types from generation (';' or ',' separated type names). diff --git a/src/PolySharp.Package/README.md b/src/PolySharp.Package/README.md index 0cacf88..0e55fcf 100644 --- a/src/PolySharp.Package/README.md +++ b/src/PolySharp.Package/README.md @@ -89,6 +89,7 @@ It also includes the following optional runtime-supported polyfills: The following properties are available: - "PolySharpUsePublicAccessibilityForGeneratedTypes": makes all generated types public. +- "PolySharpUseEmbeddedAttributeForGeneratedTypes": adds the `[Embedded]` attributes to generated pofylill types. - "PolySharpIncludeRuntimeSupportedAttributes": enables polyfills for (dummy) runtime-supported attributes too. - "PolySharpUseInteropServices2NamespaceForUnmanagedCallersOnlyAttribute": moves `[UnmanagedCallersOnly]`. - "PolySharpExcludeGeneratedTypes": excludes specific types from generation (';' or ',' separated type names). diff --git a/src/PolySharp.SourceGenerators/Constants/PolySharpMSBuildProperties.cs b/src/PolySharp.SourceGenerators/Constants/PolySharpMSBuildProperties.cs index 13eb25c..039e6b2 100644 --- a/src/PolySharp.SourceGenerators/Constants/PolySharpMSBuildProperties.cs +++ b/src/PolySharp.SourceGenerators/Constants/PolySharpMSBuildProperties.cs @@ -10,6 +10,11 @@ internal static class PolySharpMSBuildProperties /// public const string UsePublicAccessibilityForGeneratedTypes = "PolySharpUsePublicAccessibilityForGeneratedTypes"; + /// + /// The MSBuild property for . + /// + public const string UseEmbeddedAttributeForGeneratedTypes = "PolySharpUseEmbeddedAttributeForGeneratedTypes"; + /// /// The MSBuild property for . /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.AllowNullAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.AllowNullAttribute.cs similarity index 94% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.AllowNullAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.AllowNullAttribute.cs index 966a32f..4ba8168 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.AllowNullAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.AllowNullAttribute.cs @@ -16,6 +16,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Property, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class AllowNullAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute.cs similarity index 95% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute.cs index 0c85229..7ede491 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute.cs @@ -15,6 +15,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class ConstantExpectedAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DisallowNullAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DisallowNullAttribute.cs similarity index 94% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DisallowNullAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DisallowNullAttribute.cs index 749216a..a8a5776 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DisallowNullAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DisallowNullAttribute.cs @@ -16,6 +16,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Property, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class DisallowNullAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.cs similarity index 93% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.cs index a8a8c14..096a0d7 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.cs @@ -12,6 +12,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class DoesNotReturnAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.cs similarity index 96% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.cs index 90c066a..f4cfe4d 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.cs @@ -12,6 +12,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class DoesNotReturnIfAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.ExperimentalAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.ExperimentalAttribute.cs similarity index 98% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.ExperimentalAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.ExperimentalAttribute.cs index 0ffefc8..1eb2d05 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.ExperimentalAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.ExperimentalAttribute.cs @@ -29,6 +29,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Delegate, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class ExperimentalAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MaybeNullAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MaybeNullAttribute.cs similarity index 94% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MaybeNullAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MaybeNullAttribute.cs index 21a631b..81efb9a 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MaybeNullAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MaybeNullAttribute.cs @@ -17,6 +17,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.ReturnValue, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class MaybeNullAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.cs similarity index 96% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.cs index 86d2817..4f69532 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute.cs @@ -12,6 +12,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class MaybeNullWhenAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MemberNotNullAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MemberNotNullAttribute.cs similarity index 97% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MemberNotNullAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MemberNotNullAttribute.cs index d8481a8..a3e1f41 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MemberNotNullAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MemberNotNullAttribute.cs @@ -15,6 +15,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class MemberNotNullAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute.cs similarity index 98% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute.cs index 40355d0..77e0555 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute.cs @@ -16,6 +16,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class MemberNotNullWhenAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullAttribute.cs similarity index 95% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullAttribute.cs index ef52104..4232d87 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullAttribute.cs @@ -18,6 +18,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.ReturnValue, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class NotNullAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.cs similarity index 96% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.cs index 839b717..c48a3e3 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute.cs @@ -16,6 +16,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class NotNullIfNotNullAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.cs similarity index 96% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.cs index e91adc3..bfbcc50 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.cs @@ -12,6 +12,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class NotNullWhenAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute.cs similarity index 94% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute.cs index cc10d01..118d3ad 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute.cs @@ -13,6 +13,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(global::System.AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class SetsRequiredMembersAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.cs similarity index 98% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.cs index d5324ef..e69d8c9 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.cs @@ -16,6 +16,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class StringSyntaxAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.UnscopedRefAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.UnscopedRefAttribute.cs similarity index 97% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.UnscopedRefAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.UnscopedRefAttribute.cs index 71c248d..54da81d 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Diagnostics.CodeAnalysis.UnscopedRefAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Diagnostics.CodeAnalysis.UnscopedRefAttribute.cs @@ -38,6 +38,7 @@ namespace System.Diagnostics.CodeAnalysis AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class UnscopedRefAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Index.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Index.cs similarity index 99% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Index.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Index.cs index 4b41933..8d60cb2 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Index.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Index.cs @@ -16,6 +16,7 @@ namespace System /// /// [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal readonly struct Index : global::System.IEquatable { private readonly int _value; diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Range.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Range.cs similarity index 99% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Range.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Range.cs index d0e8a48..753450e 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Range.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Range.cs @@ -17,6 +17,7 @@ namespace System /// /// [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal readonly struct Range : global::System.IEquatable { /// Represent the inclusive start index of the Range. diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.AsyncMethodBuilderAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.AsyncMethodBuilderAttribute.cs similarity index 97% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.AsyncMethodBuilderAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.AsyncMethodBuilderAttribute.cs index 3fd90fe..37417fb 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.AsyncMethodBuilderAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.AsyncMethodBuilderAttribute.cs @@ -21,6 +21,7 @@ namespace System.Runtime.CompilerServices global::System.AttributeTargets.Method, Inherited = false, AllowMultiple = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class AsyncMethodBuilderAttribute : global::System.Attribute { /// Initializes the . diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CallerArgumentExpressionAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CallerArgumentExpressionAttribute.cs similarity index 96% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CallerArgumentExpressionAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CallerArgumentExpressionAttribute.cs index a22c7d8..751bb6b 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CallerArgumentExpressionAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CallerArgumentExpressionAttribute.cs @@ -12,6 +12,7 @@ namespace System.Runtime.CompilerServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class CallerArgumentExpressionAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CollectionBuilderAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CollectionBuilderAttribute.cs similarity index 97% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CollectionBuilderAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CollectionBuilderAttribute.cs index d1a037e..ed965e5 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CollectionBuilderAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CollectionBuilderAttribute.cs @@ -13,6 +13,7 @@ namespace System.Runtime.CompilerServices global::System.AttributeTargets.Interface, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class CollectionBuilderAttribute : Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute.cs similarity index 97% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute.cs index 1f64f35..3909985 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute.cs @@ -12,6 +12,7 @@ namespace System.Runtime.CompilerServices /// [global::System.AttributeUsage(global::System.AttributeTargets.All, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class CompilerFeatureRequiredAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute.cs similarity index 97% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute.cs index f8b1d28..0042cb9 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute.cs @@ -12,6 +12,7 @@ namespace System.Runtime.CompilerServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class InterpolatedStringHandlerArgumentAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute.cs similarity index 94% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute.cs index 89fe96c..8bb10db 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute.cs @@ -15,6 +15,7 @@ namespace System.Runtime.CompilerServices global::System.AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class InterpolatedStringHandlerAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.IsExternalInit.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.IsExternalInit.cs similarity index 93% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.IsExternalInit.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.IsExternalInit.cs index 72de835..91064ef 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.IsExternalInit.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.IsExternalInit.cs @@ -13,6 +13,7 @@ namespace System.Runtime.CompilerServices /// [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal static class IsExternalInit { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.ModuleInitializerAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.ModuleInitializerAttribute.cs similarity index 97% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.ModuleInitializerAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.ModuleInitializerAttribute.cs index 19711cc..6e6028e 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.ModuleInitializerAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.ModuleInitializerAttribute.cs @@ -29,6 +29,7 @@ namespace System.Runtime.CompilerServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class ModuleInitializerAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute.cs similarity index 96% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute.cs index bdaeaf6..0bf2680 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute.cs @@ -17,6 +17,7 @@ namespace System.Runtime.CompilerServices AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class OverloadResolutionPriorityAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.ParamCollectionAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.ParamCollectionAttribute.cs similarity index 93% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.ParamCollectionAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.ParamCollectionAttribute.cs index 9874cfd..f8db646 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.ParamCollectionAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.ParamCollectionAttribute.cs @@ -12,6 +12,7 @@ namespace System.Runtime.CompilerServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class ParamCollectionAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.RequiredMemberAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.RequiredMemberAttribute.cs similarity index 94% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.RequiredMemberAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.RequiredMemberAttribute.cs index 414c9c0..e1c830c 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.RequiredMemberAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.RequiredMemberAttribute.cs @@ -18,6 +18,7 @@ namespace System.Runtime.CompilerServices AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class RequiredMemberAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.RequiresLocationAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.RequiresLocationAttribute.cs similarity index 94% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.RequiresLocationAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.RequiresLocationAttribute.cs index 53ea973..5a422b7 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.RequiresLocationAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.RequiresLocationAttribute.cs @@ -14,6 +14,7 @@ namespace System.Runtime.CompilerServices [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class RequiresLocationAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.SkipLocalsInitAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.SkipLocalsInitAttribute.cs similarity index 95% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.SkipLocalsInitAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.SkipLocalsInitAttribute.cs index 4b4df5e..62b6cd9 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.CompilerServices.SkipLocalsInitAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.CompilerServices.SkipLocalsInitAttribute.cs @@ -21,6 +21,7 @@ namespace System.Runtime.CompilerServices global::System.AttributeTargets.Event, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class SkipLocalsInitAttribute : global::System.Attribute { } diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.Versioning.RequiresPreviewFeaturesAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.Versioning.RequiresPreviewFeaturesAttribute.cs similarity index 97% rename from src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.Versioning.RequiresPreviewFeaturesAttribute.cs rename to src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.Versioning.RequiresPreviewFeaturesAttribute.cs index 153f0ca..a74dfc0 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/System.Runtime.Versioning.RequiresPreviewFeaturesAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/LanguageSupport/System.Runtime.Versioning.RequiresPreviewFeaturesAttribute.cs @@ -21,6 +21,7 @@ namespace System.Runtime.Versioning global::System.AttributeTargets.Field | AttributeTargets.Event, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] internal sealed class RequiresPreviewFeaturesAttribute : global::System.Attribute { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RoslynSupported/Microsoft.CodeAnalysis.EmbeddedAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RoslynSupported/Microsoft.CodeAnalysis.EmbeddedAttribute.cs new file mode 100644 index 0000000..5c3492c --- /dev/null +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RoslynSupported/Microsoft.CodeAnalysis.EmbeddedAttribute.cs @@ -0,0 +1,18 @@ +// +#pragma warning disable +#nullable enable annotations + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.CodeAnalysis +{ + /// + /// A special attribute recognized by Roslyn, that marks a type as "embedded", meaning it won't ever be visible from other assemblies. + /// + [global::System.AttributeUsage(global::System.AttributeTargets.All)] + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + internal sealed partial class EmbeddedAttribute : global::System.Attribute + { + } +} \ No newline at end of file diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute.cs index f01bd10..6930625 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute.cs @@ -20,6 +20,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Method, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class DynamicDependencyAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.cs index 961048b..58bf27a 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.cs @@ -14,6 +14,7 @@ namespace System.Diagnostics.CodeAnalysis /// bitwise combination of its member values. /// [global::System.Flags] + [global::Microsoft.CodeAnalysis.Embedded] internal enum DynamicallyAccessedMemberTypes { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute.cs index 0e7db46..6edb6e2 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute.cs @@ -41,6 +41,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Struct, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class DynamicallyAccessedMembersAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.FeatureGuardAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.FeatureGuardAttribute.cs index 8fc64ac..43109d8 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.FeatureGuardAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.FeatureGuardAttribute.cs @@ -18,6 +18,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(global::System.AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class FeatureGuardAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute.cs index aa010fd..bb3cf2c 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute.cs @@ -17,6 +17,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(global::System.AttributeTargets.Property, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class FeatureSwitchDefinitionAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute.cs index a8af0dc..26a0ba2 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute.cs @@ -17,6 +17,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Property, Inherited = false, AllowMultiple = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class RequiresAssemblyFilesAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute.cs index 67b4f00..a4e6b2f 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute.cs @@ -20,6 +20,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Class, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class RequiresDynamicCodeAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute.cs index 50015b0..614c09e 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute.cs @@ -20,6 +20,7 @@ namespace System.Diagnostics.CodeAnalysis global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Class, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class RequiresUnreferencedCodeAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.cs index 82d3044..3c2915e 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.cs @@ -18,6 +18,7 @@ namespace System.Diagnostics.CodeAnalysis /// [global::System.AttributeUsage(global::System.AttributeTargets.All, Inherited = false, AllowMultiple = true)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class UnconditionalSuppressMessageAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.DebuggerDisableUserUnhandledExceptionsAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.DebuggerDisableUserUnhandledExceptionsAttribute.cs index 6212cb9..4766347 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.DebuggerDisableUserUnhandledExceptionsAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.DebuggerDisableUserUnhandledExceptionsAttribute.cs @@ -14,6 +14,7 @@ namespace System.Diagnostics /// [global::System.AttributeUsage(global::System.AttributeTargets.Method)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class DebuggerDisableUserUnhandledExceptionsAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.StackTraceHiddenAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.StackTraceHiddenAttribute.cs index 883fd7b..906f421 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.StackTraceHiddenAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Diagnostics.StackTraceHiddenAttribute.cs @@ -18,6 +18,7 @@ namespace System.Diagnostics global::System.AttributeTargets.Struct, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class StackTraceHiddenAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute.cs index 5d38661..808717e 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute.cs @@ -26,6 +26,7 @@ namespace System.Runtime.CompilerServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class DisableRuntimeMarshallingAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.InlineArrayAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.InlineArrayAttribute.cs index 0a87456..9e84164 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.InlineArrayAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.InlineArrayAttribute.cs @@ -28,6 +28,7 @@ namespace System.Runtime.CompilerServices2 /// [global::System.AttributeUsage(global::System.AttributeTargets.Struct, AllowMultiple = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class InlineArrayAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorAttribute.cs index 0a2591c..efd561d 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorAttribute.cs @@ -50,6 +50,7 @@ namespace System.Runtime.CompilerServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Method, AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class UnsafeAccessorAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorKind.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorKind.cs index 7cb4fc3..58f12e6 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorKind.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.CompilerServices.UnsafeAccessorKind.cs @@ -10,6 +10,7 @@ namespace System.Runtime.CompilerServices /// /// Specifies the kind of target to which an is providing access. /// + [global::Microsoft.CodeAnalysis.Embedded] internal enum UnsafeAccessorKind { /// diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.SuppressGCTransitionAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.SuppressGCTransitionAttribute.cs index b2056d6..088ddcb 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.SuppressGCTransitionAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.SuppressGCTransitionAttribute.cs @@ -63,6 +63,7 @@ namespace System.Runtime.InteropServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class SuppressGCTransitionAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute.cs index a2b1b22..1797dc0 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute.cs @@ -20,6 +20,7 @@ namespace System.Runtime.InteropServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class UnmanagedCallersOnlyAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.WasmImportLinkageAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.WasmImportLinkageAttribute.cs index b1f62fc..2300606 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.WasmImportLinkageAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.InteropServices.WasmImportLinkageAttribute.cs @@ -15,6 +15,7 @@ namespace System.Runtime.InteropServices /// [global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class WasmImportLinkageAttribute : global::System.Attribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.ObsoletedOSPlatformAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.ObsoletedOSPlatformAttribute.cs index 344fcc9..c7a6b64 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.ObsoletedOSPlatformAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.ObsoletedOSPlatformAttribute.cs @@ -27,6 +27,7 @@ namespace System.Runtime.Versioning global::System.AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class ObsoletedOSPlatformAttribute : global::System.Attribute // OSPlatformAttribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.SupportedOSPlatformAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.SupportedOSPlatformAttribute.cs index 04284dc..596d8df 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.SupportedOSPlatformAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.SupportedOSPlatformAttribute.cs @@ -31,6 +31,7 @@ namespace System.Runtime.Versioning global::System.AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class SupportedOSPlatformAttribute : global::System.Attribute // OSPlatformAttribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.SupportedOSPlatformGuardAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.SupportedOSPlatformGuardAttribute.cs index f66938f..2965c9d 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.SupportedOSPlatformGuardAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.SupportedOSPlatformGuardAttribute.cs @@ -23,6 +23,7 @@ namespace System.Runtime.Versioning global::System.AttributeTargets.Property, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class SupportedOSPlatformGuardAttribute : global::System.Attribute // OSPlatformAttribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.TargetPlatformAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.TargetPlatformAttribute.cs index 4f564e5..8ba7ebe 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.TargetPlatformAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.TargetPlatformAttribute.cs @@ -12,6 +12,7 @@ namespace System.Runtime.Versioning /// [global::System.AttributeUsage(global::System.AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class TargetPlatformAttribute : global::System.Attribute // OSPlatformAttribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.UnsupportedOSPlatformAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.UnsupportedOSPlatformAttribute.cs index 69d86c0..cc77296 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.UnsupportedOSPlatformAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.UnsupportedOSPlatformAttribute.cs @@ -28,6 +28,7 @@ namespace System.Runtime.Versioning global::System.AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class UnsupportedOSPlatformAttribute : global::System.Attribute // OSPlatformAttribute { diff --git a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute.cs b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute.cs index 77aa96d..9634013 100644 --- a/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute.cs +++ b/src/PolySharp.SourceGenerators/EmbeddedResources/RuntimeSupported/System.Runtime.Versioning.UnsupportedOSPlatformGuardAttribute.cs @@ -23,6 +23,7 @@ namespace System.Runtime.Versioning global::System.AttributeTargets.Property, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [global::Microsoft.CodeAnalysis.Embedded] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] internal sealed class UnsupportedOSPlatformGuardAttribute : global::System.Attribute // OSPlatformAttribute { diff --git a/src/PolySharp.SourceGenerators/Extensions/AnalyzerConfigOptionsProviderExtensions.cs b/src/PolySharp.SourceGenerators/Extensions/AnalyzerConfigOptionsProviderExtensions.cs index d4521af..92dd486 100644 --- a/src/PolySharp.SourceGenerators/Extensions/AnalyzerConfigOptionsProviderExtensions.cs +++ b/src/PolySharp.SourceGenerators/Extensions/AnalyzerConfigOptionsProviderExtensions.cs @@ -46,6 +46,28 @@ public static bool GetBoolMSBuildProperty(this AnalyzerConfigOptionsProvider opt string.Equals(propertyValue, bool.TrueString, StringComparison.OrdinalIgnoreCase); } + /// + /// Gets the value of a MSBuild property. + /// + /// The input instance. + /// The MSBuild property name. + /// The default value for the property, if missing. + /// The value of the specified MSBuild property, or . + public static bool GetBoolMSBuildProperty(this AnalyzerConfigOptionsProvider options, string propertyName, bool defaultValue = false) + { + if (!options.GlobalOptions.TryGetValue($"build_property.{propertyName}", out string? propertyValue)) + { + return defaultValue; + } + + if (string.IsNullOrEmpty(propertyValue)) + { + return defaultValue; + } + + return string.Equals(propertyValue, bool.TrueString, StringComparison.OrdinalIgnoreCase); + } + /// /// Gets the value of an MSBuild property representing a semicolon-separated list of -s. /// diff --git a/src/PolySharp.SourceGenerators/Extensions/AssemblyExtensions.cs b/src/PolySharp.SourceGenerators/Extensions/AssemblyExtensions.cs new file mode 100644 index 0000000..497c4cc --- /dev/null +++ b/src/PolySharp.SourceGenerators/Extensions/AssemblyExtensions.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Reflection; + +namespace PolySharp.SourceGenerators.Extensions; + +/// +/// Extension methods for the type. +/// +internal static class AssemblyExtensions +{ + /// + /// Reads a manifest resue from the specified assembly and returns its content as a . + /// + /// The assemlby to read from. + /// The name of the resource to read. + /// The resource contents. + public static string ReadManifestResource(this Assembly assembly, string resourceName) + { + using Stream stream = typeof(PolyfillsGenerator).Assembly.GetManifestResourceStream(resourceName); + using StreamReader reader = new(stream); + + return reader.ReadToEnd(); + } +} \ No newline at end of file diff --git a/src/PolySharp.SourceGenerators/Models/GeneratedType.cs b/src/PolySharp.SourceGenerators/Models/GeneratedType.cs index 9fd4111..e0f770a 100644 --- a/src/PolySharp.SourceGenerators/Models/GeneratedType.cs +++ b/src/PolySharp.SourceGenerators/Models/GeneratedType.cs @@ -4,9 +4,5 @@ namespace PolySharp.SourceGenerators.Models; /// A model to hold information on a type to generate. /// /// The fully qualified type name of the type to generate. -/// Whether to use public accessibility for the generated type. /// The types of syntax fixups to apply. -internal sealed record GeneratedType( - string FullyQualifiedMetadataName, - bool IsPublicAccessibilityRequired, - SyntaxFixupType FixupType); +internal sealed record GeneratedType(string FullyQualifiedMetadataName, SyntaxFixupType FixupType); diff --git a/src/PolySharp.SourceGenerators/Models/GenerationOptions.cs b/src/PolySharp.SourceGenerators/Models/GenerationOptions.cs index f436b69..f6233ab 100644 --- a/src/PolySharp.SourceGenerators/Models/GenerationOptions.cs +++ b/src/PolySharp.SourceGenerators/Models/GenerationOptions.cs @@ -6,6 +6,7 @@ namespace PolySharp.SourceGenerators.Models; /// A model to hold all generation options for the source generator. /// /// Whether to use public accessibility for the generated types. +/// Whether to emit the [Embedded] attribute and apply it to generated types. /// Whether to also generated dummy runtime supported attributes. /// Whether to move the [UnmanagedCallersOnly] type to a dummy InteropServices2 namespace. /// Whether to never generate any [TypeForwardedTo] declarations automatically. @@ -13,6 +14,7 @@ namespace PolySharp.SourceGenerators.Models; /// The collection of fully qualified type names of types to include in the generation. internal sealed record GenerationOptions( bool UsePublicAccessibilityForGeneratedTypes, + bool UseEmbeddedAttributeForGeneratedTypes, bool IncludeRuntimeSupportedAttributes, bool UseInteropServices2NamespaceForUnmanagedCallersOnlyAttribute, bool ExcludeTypeForwardedToDeclarations, diff --git a/src/PolySharp.SourceGenerators/Models/SyntaxFixupType.cs b/src/PolySharp.SourceGenerators/Models/SyntaxFixupType.cs index bc37406..b0e6490 100644 --- a/src/PolySharp.SourceGenerators/Models/SyntaxFixupType.cs +++ b/src/PolySharp.SourceGenerators/Models/SyntaxFixupType.cs @@ -13,25 +13,35 @@ internal enum SyntaxFixupType /// None = 0, + /// + /// Uses the accessibility modifier (instead of ). + /// + UsePublicAccessibilityModifier = 1 << 0, + + /// + /// Remove all [Embedded] attributes. + /// + RemoveEmbeddedAttributes = 1 << 1, + /// /// Remove all [MethodImpl] attributes. /// - RemoveMethodImplAttributes = 1 << 0, + RemoveMethodImplAttributes = 1 << 2, /// /// Remove all [ExcludeFromCodeCoverage] attributes. /// - RemoveExcludeFromCodeCoverageAttributes = 1 << 1, + RemoveExcludeFromCodeCoverageAttributes = 1 << 3, /// /// Generates the [UnmanagedCallersOnly] type in the InteropServices2 dummy namespace. /// /// This is needed when methods annotated with the attribute have to be assigned to delegates, which Roslyn will otherwise block. - UseInteropServices2ForUnmanagedCallersOnlyAttribute = 1 << 2, + UseInteropServices2ForUnmanagedCallersOnlyAttribute = 1 << 4, /// /// Generates a global using for the [InlineArray] type in the dummy namespace. /// /// This is always needed when the type is used, as the usage is entirely blocked in the normal namespace. - EmitGlobalUsingForInlineArrayAttribute = 1 << 3 + EmitGlobalUsingForInlineArrayAttribute = 1 << 5 } diff --git a/src/PolySharp.SourceGenerators/PolySharp.SourceGenerators.csproj b/src/PolySharp.SourceGenerators/PolySharp.SourceGenerators.csproj index a154b68..4be0497 100644 --- a/src/PolySharp.SourceGenerators/PolySharp.SourceGenerators.csproj +++ b/src/PolySharp.SourceGenerators/PolySharp.SourceGenerators.csproj @@ -2,6 +2,7 @@ netstandard2.0 + true false diff --git a/src/PolySharp.SourceGenerators/PolySharp.targets b/src/PolySharp.SourceGenerators/PolySharp.targets index e9f4075..b8c2496 100644 --- a/src/PolySharp.SourceGenerators/PolySharp.targets +++ b/src/PolySharp.SourceGenerators/PolySharp.targets @@ -109,6 +109,7 @@ + diff --git a/src/PolySharp.SourceGenerators/PolyfillsGenerator.Polyfills.cs b/src/PolySharp.SourceGenerators/PolyfillsGenerator.Polyfills.cs index eec140e..8bfd582 100644 --- a/src/PolySharp.SourceGenerators/PolyfillsGenerator.Polyfills.cs +++ b/src/PolySharp.SourceGenerators/PolyfillsGenerator.Polyfills.cs @@ -23,7 +23,7 @@ partial class PolyfillsGenerator /// /// A regex to extract the fully qualified type name of a type from its embedded resource name. /// - private const string EmbeddedResourceNameToFullyQualifiedTypeNameRegex = @"^PolySharp\.SourceGenerators\.EmbeddedResources(?:\.RuntimeSupported)?\.(System(?:\.\w+)+)\.cs$"; + private const string EmbeddedResourceNameToFullyQualifiedTypeNameRegex = @"^PolySharp\.SourceGenerators\.EmbeddedResources\.\w+\.(\w+(?:\.\w+)+)\.cs$"; /// /// The mapping of fully qualified type names to embedded resource names. @@ -36,17 +36,17 @@ from string resourceName in typeof(PolyfillsGenerator).Assembly.GetManifestResou /// The collection of fully qualified type names for language support types. /// private static readonly ImmutableArray LanguageSupportTypeNames = ImmutableArray.CreateRange( - from string resourceName in typeof(PolyfillsGenerator).Assembly.GetManifestResourceNames() - where !resourceName.StartsWith("PolySharp.SourceGenerators.EmbeddedResources.RuntimeSupported.") - select Regex.Match(resourceName, EmbeddedResourceNameToFullyQualifiedTypeNameRegex).Groups[1].Value); + from KeyValuePair resource in FullyQualifiedTypeNamesToResourceNames + where resource.Value.StartsWith("PolySharp.SourceGenerators.EmbeddedResources.LanguageSupport.") + select resource.Key); /// /// The collection of fully qualified type names for runtime supported types. /// private static readonly ImmutableArray RuntimeSupportedTypeNames = ImmutableArray.CreateRange( - from string resourceName in typeof(PolyfillsGenerator).Assembly.GetManifestResourceNames() - where resourceName.StartsWith("PolySharp.SourceGenerators.EmbeddedResources.RuntimeSupported.") - select Regex.Match(resourceName, EmbeddedResourceNameToFullyQualifiedTypeNameRegex).Groups[1].Value); + from KeyValuePair resource in FullyQualifiedTypeNamesToResourceNames + where resource.Value.StartsWith("PolySharp.SourceGenerators.EmbeddedResources.RuntimeSupported.") + select resource.Key); /// /// The collection of all fully qualified type names for available polyfill types. @@ -63,6 +63,11 @@ where resourceName.StartsWith("PolySharp.SourceGenerators.EmbeddedResources.Runt /// private static readonly Regex ExcludeFromCodeCoverageRegex = new(@" *\[global::System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverage\]\r?\n", RegexOptions.Compiled); + /// + /// The to find all uses. + /// + private static readonly Regex EmbeddedAttributeRegex = new(@" *\[global::Microsoft\.CodeAnalysis\.Embedded\]\r?\n", RegexOptions.Compiled); + /// /// The dictionary of cached sources to produce. /// @@ -80,6 +85,9 @@ private static GenerationOptions GetGenerationOptions(AnalyzerConfigOptionsProvi // $(PolySharpUsePublicAccessibilityForGeneratedTypes) MSBuild property to configure this however they need. bool usePublicAccessibilityForGeneratedTypes = options.GetBoolMSBuildProperty(PolySharpMSBuildProperties.UsePublicAccessibilityForGeneratedTypes); + // Check whether to emit the '[Embedded]' attribute and apply it to generated types + bool useEmbeddedAttributeForGeneratedTypes = options.GetBoolMSBuildProperty(PolySharpMSBuildProperties.UseEmbeddedAttributeForGeneratedTypes, defaultValue: true); + // Do the same as above for all other available boolean properties bool includeRuntimeSupportedAttributes = options.GetBoolMSBuildProperty(PolySharpMSBuildProperties.IncludeRuntimeSupportedAttributes); bool useInteropServices2NamespaceForUnmanagedCallersOnlyAttribute = options.GetBoolMSBuildProperty(PolySharpMSBuildProperties.UseInteropServices2NamespaceForUnmanagedCallersOnlyAttribute); @@ -94,6 +102,7 @@ private static GenerationOptions GetGenerationOptions(AnalyzerConfigOptionsProvi return new( usePublicAccessibilityForGeneratedTypes, + useEmbeddedAttributeForGeneratedTypes, includeRuntimeSupportedAttributes, useInteropServices2NamespaceForUnmanagedCallersOnlyAttribute, excludeTypeForwardedToDeclarations, @@ -238,7 +247,32 @@ static SyntaxFixupType GetSyntaxFixupType(AvailableType availableType, Generatio // Combine the syntax type with any analyzer options SyntaxFixupType fixupType = info.AvailableType.FixupType | GetSyntaxFixupType(info.AvailableType, info.Options); - return new(info.AvailableType.FullyQualifiedMetadataName, info.Options.UsePublicAccessibilityForGeneratedTypes, fixupType); + // Also combine additional flags from project settings + fixupType |= info.Options.UsePublicAccessibilityForGeneratedTypes ? SyntaxFixupType.UsePublicAccessibilityModifier : SyntaxFixupType.None; + fixupType |= !info.Options.UseEmbeddedAttributeForGeneratedTypes ? SyntaxFixupType.RemoveEmbeddedAttributes : SyntaxFixupType.None; + + return new(info.AvailableType.FullyQualifiedMetadataName, fixupType); + } + + /// + /// Emits all requested "pre-initialization" types (but as an output step, so we can handle conditions). + /// + /// The input instance to use to emit code. + /// The input instance to use to emit code. + private static void EmitPreInitializationTypes(SourceProductionContext context, GenerationOptions options) + { + // Emit the '[Embedded]' definition, which is used by all polyfill types. This is needed to avoid + // conflicts when multiple polyfills are transitively visible in scenarios such as '[InternalsVisibleTo]'. + // When '[Embedded]' is used, Roslyn will instead just pick one of the accessible copies, with no errors. + if (options.UseEmbeddedAttributeForGeneratedTypes) + { + string resourceName = FullyQualifiedTypeNamesToResourceNames["Microsoft.CodeAnalysis.EmbeddedAttribute"]; + + // We don't need any adjustments for this attribute, we just read it directly from the embedded resource + string sourceText = typeof(PolyfillsGenerator).Assembly.ReadManifestResource(resourceName); + + context.AddSource("Microsoft.CodeAnalysis.EmbeddedAttribute.g.cs", sourceText); + } } /// @@ -255,8 +289,8 @@ private void EmitGeneratedType(SourceProductionContext context, GeneratedType ty using Stream stream = typeof(PolyfillsGenerator).Assembly.GetManifestResourceStream(resourceName); - // If public accessibility has been requested or a syntax fixup is needed, we need to update the loaded source files - if (type is { IsPublicAccessibilityRequired: true } or { FixupType: not SyntaxFixupType.None }) + // If a syntax fixup is needed, we need to update the loaded source files + if (type is { FixupType: not SyntaxFixupType.None }) { string adjustedSource; @@ -265,13 +299,22 @@ private void EmitGeneratedType(SourceProductionContext context, GeneratedType ty adjustedSource = reader.ReadToEnd(); } - if (type.IsPublicAccessibilityRequired) + if ((type.FixupType & SyntaxFixupType.UsePublicAccessibilityModifier) != 0) { // After reading the file, replace all internal keywords with public. Use a space before and after the identifier // to avoid potential false positives. This could also be done by loading the source tree and using a syntax // rewriter, or just by retrieving the type declaration syntax and updating the modifier tokens, but since the // change is so minimal, it can very well just be done this way to keep things simple, that's fine in this case. adjustedSource = adjustedSource.Replace(" internal ", " public "); + + // If types are public, we also need to strip the '[Embedded]' attributes, as it's not allowed on public types + adjustedSource = EmbeddedAttributeRegex.Replace(adjustedSource, ""); + } + else if ((type.FixupType & SyntaxFixupType.RemoveEmbeddedAttributes) != 0) + { + // Remove the '[Embedded]' attributes as above, if requested. We only need this check if types + // are not public, or these attributes would've already been stripped by the previous branch. + adjustedSource = EmbeddedAttributeRegex.Replace(adjustedSource, ""); } if ((type.FixupType & SyntaxFixupType.RemoveMethodImplAttributes) != 0) @@ -311,7 +354,7 @@ namespace System.Runtime.CompilerServices2 } else { - // If the default accessibility is used, we can load the source directly + // Otherwise if no fixups are needed, we can load the source directly sourceText = SourceText.From(stream, Encoding.UTF8, canBeEmbedded: true); } diff --git a/src/PolySharp.SourceGenerators/PolyfillsGenerator.cs b/src/PolySharp.SourceGenerators/PolyfillsGenerator.cs index aff08fd..d2c4e5e 100644 --- a/src/PolySharp.SourceGenerators/PolyfillsGenerator.cs +++ b/src/PolySharp.SourceGenerators/PolyfillsGenerator.cs @@ -18,6 +18,9 @@ public void Initialize(IncrementalGeneratorInitializationContext context) context.AnalyzerConfigOptionsProvider .Select(GetGenerationOptions); + // Generate sources that only depend on the options in use + context.RegisterSourceOutput(generationOptions, EmitPreInitializationTypes); + // Get the sequence of all available types that could be generated IncrementalValuesProvider availableTypes = context.CompilationProvider diff --git a/tests/PolySharp.Tests.UsePublicAccessibility/PolySharp.Tests.UsePublicAccessibility.csproj b/tests/PolySharp.Tests.UsePublicAccessibility/PolySharp.Tests.UsePublicAccessibility.csproj new file mode 100644 index 0000000..1a5d5e0 --- /dev/null +++ b/tests/PolySharp.Tests.UsePublicAccessibility/PolySharp.Tests.UsePublicAccessibility.csproj @@ -0,0 +1,32 @@ + + + + + net472;net48;net481;netstandard2.0;netstandard2.1;net8.0;net9.0 + true + true + + + + + + + + + + + + + + + + + + + + +