diff --git a/eng/generators.targets b/eng/generators.targets index aec6e667a6efdb..4e7d7b99b44031 100644 --- a/eng/generators.targets +++ b/eng/generators.targets @@ -10,10 +10,7 @@ + - references System.Runtime.InteropServices --> - + + + true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0 $(NoWarn);CA2249 + annotations true true true diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj index 8ee73ae4c1d284..102c67d81410e3 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj +++ b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj @@ -4,6 +4,7 @@ true $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum)-OSX;$(NetCoreAppMinimum)-Linux;$(NetCoreAppMinimum);netstandard2.0 true + annotations true true Provides the methods defined in the Lightweight Directory Access Protocol (LDAP) version 3 (V3) and Directory Services Markup Language (DSML) version 2.0 (V2) standards. diff --git a/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/PInvokeStubCodeGenerator.cs b/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/PInvokeStubCodeGenerator.cs index 4c9bbd0b1e3920..9eb5f6272a6590 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/PInvokeStubCodeGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/PInvokeStubCodeGenerator.cs @@ -197,6 +197,15 @@ BoundGenerator CreateGenerator(TypePositionInfo p) { try { + // TODO: Remove once helper types (like ArrayMarshaller) are part of the runtime + // This check is to help with enabling the source generator for runtime libraries without making each + // library directly reference System.Memory and System.Runtime.CompilerServices.Unsafe unless it needs to + if (p.MarshallingAttributeInfo is MissingSupportMarshallingInfo + && (environment.TargetFramework == TargetFramework.Net && environment.TargetFrameworkVersion.Major >= 7)) + { + throw new MarshallingNotSupportedException(p, this); + } + return new BoundGenerator(p, generatorFactory.Create(p, this)); } catch (MarshallingNotSupportedException e) diff --git a/src/libraries/System.Speech/src/System.Speech.csproj b/src/libraries/System.Speech/src/System.Speech.csproj index 0a72d5a24dbf7f..783e89d8b0e4bd 100644 --- a/src/libraries/System.Speech/src/System.Speech.csproj +++ b/src/libraries/System.Speech/src/System.Speech.csproj @@ -5,6 +5,7 @@ $(NoWarn);CS0649;SA1129;CA1847 + annotations false true true