Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eng/generators.targets25
-rw-r--r--src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj1
-rw-r--r--src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj1
-rw-r--r--src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/PInvokeStubCodeGenerator.cs9
-rw-r--r--src/libraries/System.Speech/src/System.Speech.csproj1
5 files changed, 27 insertions, 10 deletions
diff --git a/eng/generators.targets b/eng/generators.targets
index aec6e667a6e..4e7d7b99b44 100644
--- a/eng/generators.targets
+++ b/eng/generators.targets
@@ -10,10 +10,7 @@
<!-- If the current project is not System.Private.CoreLib, we enable the DllImportGenerator source generator
when the project is a C# source project that either:
- references System.Private.CoreLib, or
- - references the following assemblies:
- - System.Runtime.InteropServices
- - System.Runtime.CompilerServices.Unsafe
- - System.Memory -->
+ - references System.Runtime.InteropServices -->
<EnabledGenerators Include="DllImportGenerator"
Condition="'$(EnableDllImportGenerator)' == ''
and '$(IsFrameworkSupportFacade)' != 'true'
@@ -21,11 +18,7 @@
and '$(MSBuildProjectExtension)' == '.csproj'
and (
('@(Reference)' != ''
- and @(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.InteropServices'))
- and (@(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.CompilerServices.Unsafe'))
- or ('@(ProjectReference)' != ''
- and @(ProjectReference->AnyHaveMetadataValue('Identity', $([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'System.Runtime.CompilerServices.Unsafe', 'src', 'System.Runtime.CompilerServices.Unsafe.ilproj'))))))
- and @(Reference->AnyHaveMetadataValue('Identity', 'System.Memory')))
+ and @(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.InteropServices')))
or ('@(ProjectReference)' != ''
and @(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)'))))" />
<EnabledGenerators Include="DllImportGenerator"
@@ -45,7 +38,19 @@
<!-- Only add the following files if we are on the latest TFM (that is, net7). -->
<Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'" Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\GeneratedMarshallingAttribute.cs" />
- <Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'" Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\ArrayMarshaller.cs" />
+
+ <!-- Only add the following files if we are on the latest TFM (that is, net7) and the project is SPCL or has references to System.Runtime.CompilerServices.Unsafe and System.Memory -->
+ <Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'
+ and (
+ '$(MSBuildProjectName)' == 'System.Private.CoreLib'
+ or '$(EnableDllImportGenerator)' == 'true'
+ or ('@(Reference)' != ''
+ and (@(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.CompilerServices.Unsafe'))
+ or ('@(ProjectReference)' != ''
+ and @(ProjectReference->AnyHaveMetadataValue('Identity', $([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'System.Runtime.CompilerServices.Unsafe', 'src', 'System.Runtime.CompilerServices.Unsafe.ilproj'))))))
+ and @(Reference->AnyHaveMetadataValue('Identity', 'System.Memory')))
+ or ('@(ProjectReference)' != ''
+ and @(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)'))))" Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\ArrayMarshaller.cs" />
</ItemGroup>
<Target Name="ConfigureGenerators"
diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj b/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
index 22917a6803e..7bcd2a56a94 100644
--- a/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
+++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
@@ -4,6 +4,7 @@
<IncludeDllSafeSearchPathAttribute>true</IncludeDllSafeSearchPathAttribute>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CA2249</NoWarn>
+ <Nullable>annotations</Nullable>
<IsPackable>true</IsPackable>
<AddNETFrameworkPlaceholderFileToPackage>true</AddNETFrameworkPlaceholderFileToPackage>
<AddNETFrameworkAssemblyReferenceToPackage>true</AddNETFrameworkAssemblyReferenceToPackage>
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 8ee73ae4c1d..102c67d8141 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 @@
<IncludeDllSafeSearchPathAttribute>true</IncludeDllSafeSearchPathAttribute>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum)-OSX;$(NetCoreAppMinimum)-Linux;$(NetCoreAppMinimum);netstandard2.0</TargetFrameworks>
<IsPackable>true</IsPackable>
+ <Nullable>annotations</Nullable>
<AddNETFrameworkPlaceholderFileToPackage>true</AddNETFrameworkPlaceholderFileToPackage>
<AddNETFrameworkAssemblyReferenceToPackage>true</AddNETFrameworkAssemblyReferenceToPackage>
<PackageDescription>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.</PackageDescription>
diff --git a/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/PInvokeStubCodeGenerator.cs b/src/libraries/System.Runtime.InteropServices/gen/DllImportGenerator/PInvokeStubCodeGenerator.cs
index 4c9bbd0b1e3..9eb5f6272a6 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 @@ namespace Microsoft.Interop
{
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 0a72d5a24db..783e89d8b0e 100644
--- a/src/libraries/System.Speech/src/System.Speech.csproj
+++ b/src/libraries/System.Speech/src/System.Speech.csproj
@@ -5,6 +5,7 @@
<!-- CS0649: uninitialized interop type fields -->
<!-- SA1129: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3277 -->
<NoWarn>$(NoWarn);CS0649;SA1129;CA1847</NoWarn>
+ <Nullable>annotations</Nullable>
<SetIsTrimmable>false</SetIsTrimmable>
<IsPackable>true</IsPackable>
<AddNETFrameworkPlaceholderFileToPackage>true</AddNETFrameworkPlaceholderFileToPackage>