diff --git a/build/AzurePipelineTemplates/CsWinRT-Benchmarks-Steps.yml b/build/AzurePipelineTemplates/CsWinRT-Benchmarks-Steps.yml
index f9f763810..7822fbe9a 100644
--- a/build/AzurePipelineTemplates/CsWinRT-Benchmarks-Steps.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-Benchmarks-Steps.yml
@@ -40,10 +40,23 @@ steps:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
- dotnet new globaljson --sdk-version "$($env:NET8_SDK_VERSION)"
-
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version "$($env:NET8_SDK_VERSION)" -Architecture "x64" -AzureFeed "$($env:NET5_SDK_FEED)"
+# Install .NET 9 SDK
+- task: PowerShell@2
+ displayName: Install .NET 9 SDK
+ inputs:
+ targetType: inline
+ failOnStderr: true
+ script: |
+ Write-Host ##vso[task.setvariable variable=PATH;]${env:LocalAppData}\Microsoft\dotnet;${env:PATH};
+
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
+
+ dotnet new globaljson --sdk-version "$($env:NET9_SDK_VERSION)"
+
+ &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version "$($env:NET9_SDK_VERSION)" -Architecture "x64" -AzureFeed "$($env:NET5_SDK_FEED)"
+
# Verify .NET SDK
- task: CmdLine@2
displayName: Verify .NET SDK
diff --git a/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml b/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml
index 9ff4a279f..e101b9846 100644
--- a/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-Build-Steps.yml
@@ -62,10 +62,23 @@ steps:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
- dotnet new globaljson --sdk-version "$($env:NET8_SDK_VERSION)"
-
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version "$($env:NET8_SDK_VERSION)" -Architecture "x64" -AzureFeed "$($env:NET5_SDK_FEED)"
+# Install .NET 9 SDK
+- task: PowerShell@2
+ displayName: Install .NET 9 SDK
+ inputs:
+ targetType: inline
+ failOnStderr: true
+ script: |
+ Write-Host ##vso[task.setvariable variable=PATH;]${env:LocalAppData}\Microsoft\dotnet;${env:PATH};
+
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
+
+ dotnet new globaljson --sdk-version "$($env:NET9_SDK_VERSION)"
+
+ &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version "$($env:NET9_SDK_VERSION)" -Architecture "x64" -AzureFeed "$($env:NET5_SDK_FEED)"
+
# Verify .NET SDK
- task: CmdLine@2
displayName: Verify .NET SDK
@@ -287,6 +300,17 @@ steps:
WinRT.Runtime.pdb
TargetFolder: $(Build.ArtifactStagingDirectory)\release_net8.0
+# Stage Net9.0
+- task: CopyFiles@2
+ displayName: Stage Net9.0
+ condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release'))
+ inputs:
+ SourceFolder: $(Build.SourcesDirectory)\src\WinRT.Runtime\bin\$(BuildConfiguration)\net9.0
+ Contents: |
+ WinRT.Runtime.dll
+ WinRT.Runtime.pdb
+ TargetFolder: $(Build.ArtifactStagingDirectory)\release_net9.0
+
# Stage WinRT.Host.Shim
- task: CopyFiles@2
displayName: Stage WinRT.Host.Shim
diff --git a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
index 244bcd3dd..1a03097b6 100644
--- a/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-BuildAndTest-Stage.yml
@@ -178,6 +178,11 @@ stages:
condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release'))
targetPath: $(Build.ArtifactStagingDirectory)\release_net8.0
artifactName: net8.0
+ - output: pipelineArtifact
+ displayName: 'Publish Net9.0'
+ condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'), eq(variables['BuildConfiguration'], 'release'))
+ targetPath: $(Build.ArtifactStagingDirectory)\release_net9.0
+ artifactName: net9.0
- job: Benchmarks
displayName: Run Benchmarks
diff --git a/build/AzurePipelineTemplates/CsWinRT-PublishToNuget-Stage.yml b/build/AzurePipelineTemplates/CsWinRT-PublishToNuget-Stage.yml
index fb692d7c5..0b3c435ae 100644
--- a/build/AzurePipelineTemplates/CsWinRT-PublishToNuget-Stage.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-PublishToNuget-Stage.yml
@@ -65,6 +65,14 @@ stages:
itemPattern: ''
targetPath: $(Build.SourcesDirectory)\net8.0
+# Download Net8.0
+ - task: DownloadPipelineArtifact@2
+ displayName: 'Download Net9.0'
+ inputs:
+ artifactName: net9.0
+ itemPattern: ''
+ targetPath: $(Build.SourcesDirectory)\net9.0
+
# Stage Binaries
- task: CmdLine@2
displayName: Stage Binaries
@@ -93,6 +101,7 @@ stages:
netstandard2.0\WinRT.SourceGenerator.dll
net8.0\WinRT.Host.Shim.dll
net8.0\WinRT.Runtime.dll
+ net9.0\WinRT.Runtime.dll
release_x64\WinRT.Host.dll
release_x64\WinRT.Host.dll.mui
release_x86\WinRT.Host.dll
@@ -221,7 +230,7 @@ stages:
command: pack
searchPatternPack: nuget/Microsoft.Windows.CsWinRT.nuspec
configurationToPack: Release
- buildProperties: cswinrt_nuget_version=$(NugetVersion);cswinrt_exe=$(Build.SourcesDirectory)\cswinrt.exe;interop_winmd=$(Build.SourcesDirectory)\WinRT.Interop.winmd;netstandard2_runtime=$(Build.SourcesDirectory)\netstandard2.0\WinRT.Runtime.dll;net8_runtime=$(Build.SourcesDirectory)\net8.0\WinRT.Runtime.dll;source_generator=$(Build.SourcesDirectory)\netstandard2.0\WinRT.SourceGenerator.dll;winrt_shim=$(Build.SourcesDirectory)\net8.0\WinRT.Host.Shim.dll;winrt_host_x86=$(Build.SourcesDirectory)\release_x86\WinRT.Host.dll;winrt_host_x64=$(Build.SourcesDirectory)\release_x64\WinRT.Host.dll;winrt_host_arm64=$(Build.SourcesDirectory)\release_arm64\WinRT.Host.dll;winrt_host_resource_x86=$(Build.SourcesDirectory)\release_x86\WinRT.Host.dll.mui;winrt_host_resource_x64=$(Build.SourcesDirectory)\release_x64\WinRT.Host.dll.mui;winrt_host_resource_arm64=$(Build.SourcesDirectory)\release_arm64\WinRT.Host.dll.mui;guid_patch=$(Build.SourcesDirectory)\net8.0\IIDOptimizer\*.*
+ buildProperties: cswinrt_nuget_version=$(NugetVersion);cswinrt_exe=$(Build.SourcesDirectory)\cswinrt.exe;interop_winmd=$(Build.SourcesDirectory)\WinRT.Interop.winmd;netstandard2_runtime=$(Build.SourcesDirectory)\netstandard2.0\WinRT.Runtime.dll;net8_runtime=$(Build.SourcesDirectory)\net8.0\WinRT.Runtime.dll;net9_runtime=$(Build.SourcesDirectory)\net9.0\WinRT.Runtime.dll;source_generator=$(Build.SourcesDirectory)\netstandard2.0\WinRT.SourceGenerator.dll;winrt_shim=$(Build.SourcesDirectory)\net8.0\WinRT.Host.Shim.dll;winrt_host_x86=$(Build.SourcesDirectory)\release_x86\WinRT.Host.dll;winrt_host_x64=$(Build.SourcesDirectory)\release_x64\WinRT.Host.dll;winrt_host_arm64=$(Build.SourcesDirectory)\release_arm64\WinRT.Host.dll;winrt_host_resource_x86=$(Build.SourcesDirectory)\release_x86\WinRT.Host.dll.mui;winrt_host_resource_x64=$(Build.SourcesDirectory)\release_x64\WinRT.Host.dll.mui;winrt_host_resource_arm64=$(Build.SourcesDirectory)\release_arm64\WinRT.Host.dll.mui;guid_patch=$(Build.SourcesDirectory)\net8.0\IIDOptimizer\*.*
- task: NuGetCommand@2
displayName: NuGet pack
diff --git a/build/AzurePipelineTemplates/CsWinRT-Variables.yml b/build/AzurePipelineTemplates/CsWinRT-Variables.yml
index a660d2e07..8e2bb6d8b 100644
--- a/build/AzurePipelineTemplates/CsWinRT-Variables.yml
+++ b/build/AzurePipelineTemplates/CsWinRT-Variables.yml
@@ -12,6 +12,8 @@ variables:
value: 'https://dotnetcli.blob.core.windows.net/dotnet'
- name: Net8.SDK.Version
value: '8.0.303'
+- name: Net9.SDK.Version
+ value: '9.0.100'
- name: NoSamples
value: 'false'
@@ -26,6 +28,8 @@ variables:
value: $[coalesce(variables.RunGCStress, 'false')]
- name: _DotNetRuntimeVersion
value: $[coalesce(variables.DotNetRuntimeVersion, '8.0.303')]
+- name: _DotNet9RuntimeVersion
+ value: $[coalesce(variables.DotNet9RuntimeVersion, '9.0.100')]
- name: _WindowsSdkVersionSuffix
value: $[coalesce(variables.WindowsSdkPackageVersionSuffix, '25')]
- name: _PublishCsWinMD
diff --git a/nuget/Microsoft.Windows.CsWinRT.nuspec b/nuget/Microsoft.Windows.CsWinRT.nuspec
index d4c2c67ea..dcd0ffbc1 100644
--- a/nuget/Microsoft.Windows.CsWinRT.nuspec
+++ b/nuget/Microsoft.Windows.CsWinRT.nuspec
@@ -15,6 +15,7 @@
https://github.com/microsoft/cswinrt
+
@@ -31,11 +32,13 @@
+
+
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 30bbea813..897059641 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -28,9 +28,9 @@
true
netcoreapp3.1;net8.0
netcoreapp3.1;net8.0
- netstandard2.0;net8.0
+ netstandard2.0;net8.0;net9.0
netstandard2.0;net8.0
- net8.0
+ net8.0;net9.0
net8.0
net8.0-windows10.0.19041.0
net8.0-windows10.0.19041.0
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index b1682e78e..2424b5d23 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -17,6 +17,8 @@
+
+
diff --git a/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj b/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj
index 568b1dd87..429f1669d 100644
--- a/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj
+++ b/src/Tests/ObjectLifetimeTests/ObjectLifetimeTests.Lifted.csproj
@@ -36,6 +36,8 @@
+
+
diff --git a/src/WinRT.Runtime/Marshalers.cs b/src/WinRT.Runtime/Marshalers.cs
index c232a3cfa..b5df5fbad 100644
--- a/src/WinRT.Runtime/Marshalers.cs
+++ b/src/WinRT.Runtime/Marshalers.cs
@@ -1092,7 +1092,7 @@ public void Dispose()
public static new unsafe MarshalerArray CreateMarshalerArray(T[] array)
{
-#if NET
+#if NET && !NET9_0_OR_GREATER
if (!RuntimeFeature.IsDynamicCodeCompiled)
{
throw new NotSupportedException($"Cannot handle array marshalling for non blittable type '{typeof(T)}'.");
@@ -1108,7 +1108,12 @@ public void Dispose()
{
int length = array.Length;
#pragma warning disable IL3050 // https://github.com/dotnet/runtime/issues/97273
- var abi_element_size = Marshal.SizeOf(AbiType);
+ var abi_element_size =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.SizeOf(AbiType.TypeHandle);
+#else
+ Marshal.SizeOf(AbiType);
+#endif
#pragma warning restore IL3050
var byte_length = length * abi_element_size;
m._array = Marshal.AllocCoTaskMem(byte_length);
@@ -1140,7 +1145,7 @@ public void Dispose()
public static new unsafe T[] FromAbiArray(object box)
{
-#if NET
+#if NET && !NET9_0_OR_GREATER
if (!RuntimeFeature.IsDynamicCodeCompiled)
{
throw new NotSupportedException($"Cannot handle array marshalling for non blittable type '{typeof(T)}'.");
@@ -1158,10 +1163,20 @@ public void Dispose()
var array = new T[abi.length];
var data = (byte*)abi.data.ToPointer();
#pragma warning disable IL3050 // https://github.com/dotnet/runtime/issues/97273
- var abi_element_size = Marshal.SizeOf(AbiType);
+ var abi_element_size =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.SizeOf(AbiType.TypeHandle);
+#else
+ Marshal.SizeOf(AbiType);
+#endif
for (int i = 0; i < abi.length; i++)
{
- var abi_element = Marshal.PtrToStructure((IntPtr)data, AbiType);
+ var abi_element =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.Box(ref *data, AbiType.TypeHandle);
+#else
+ Marshal.PtrToStructure((IntPtr)data, AbiType);
+#endif
#pragma warning restore IL3050
array[i] = Marshaler.FromAbi(abi_element);
data += abi_element_size;
@@ -1171,7 +1186,7 @@ public void Dispose()
public static unsafe void CopyAbiArray(T[] array, object box)
{
-#if NET
+#if NET && !NET9_0_OR_GREATER
if (!RuntimeFeature.IsDynamicCodeCompiled)
{
throw new NotSupportedException($"Cannot handle array marshalling for non blittable type '{typeof(T)}'.");
@@ -1184,10 +1199,20 @@ public static unsafe void CopyAbiArray(T[] array, object box)
}
var data = (byte*)abi.data.ToPointer();
#pragma warning disable IL3050 // https://github.com/dotnet/runtime/issues/97273
- var abi_element_size = Marshal.SizeOf(AbiType);
+ var abi_element_size =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.SizeOf(AbiType.TypeHandle);
+#else
+ Marshal.SizeOf(AbiType);
+#endif
for (int i = 0; i < abi.length; i++)
{
- var abi_element = Marshal.PtrToStructure((IntPtr)data, AbiType);
+ var abi_element =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.Box(ref *data, AbiType.TypeHandle);
+#else
+ Marshal.PtrToStructure((IntPtr)data, AbiType);
+#endif
#pragma warning restore IL3050
array[i] = Marshaler.FromAbi(abi_element);
data += abi_element_size;
@@ -1196,7 +1221,7 @@ public static unsafe void CopyAbiArray(T[] array, object box)
public static new unsafe (int length, IntPtr data) FromManagedArray(T[] array)
{
-#if NET
+#if NET && !NET9_0_OR_GREATER
if (!RuntimeFeature.IsDynamicCodeCompiled)
{
throw new NotSupportedException($"Cannot handle array marshalling for non blittable type '{typeof(T)}'.");
@@ -1213,7 +1238,12 @@ public static unsafe void CopyAbiArray(T[] array, object box)
{
int length = array.Length;
#pragma warning disable IL3050 // https://github.com/dotnet/runtime/issues/97273
- var abi_element_size = Marshal.SizeOf(AbiType);
+ var abi_element_size =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.SizeOf(AbiType.TypeHandle);
+#else
+ Marshal.SizeOf(AbiType);
+#endif
#pragma warning restore IL3050
var byte_length = length * abi_element_size;
data = Marshal.AllocCoTaskMem(byte_length);
@@ -1237,7 +1267,7 @@ public static unsafe void CopyAbiArray(T[] array, object box)
public static unsafe void CopyManagedArray(T[] array, IntPtr data)
{
-#if NET
+#if NET && !NET9_0_OR_GREATER
if (!RuntimeFeature.IsDynamicCodeCompiled)
{
throw new NotSupportedException($"Cannot handle array marshalling for non blittable type '{typeof(T)}'.");
@@ -1254,7 +1284,12 @@ public static unsafe void CopyManagedArray(T[] array, IntPtr data)
{
int length = array.Length;
#pragma warning disable IL3050 // https://github.com/dotnet/runtime/issues/97273
- var abi_element_size = Marshal.SizeOf(AbiType);
+ var abi_element_size =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.SizeOf(AbiType.TypeHandle);
+#else
+ Marshal.SizeOf(AbiType);
+#endif
#pragma warning restore IL3050
var byte_length = length * abi_element_size;
var bytes = (byte*)data.ToPointer();
@@ -1278,7 +1313,7 @@ public static unsafe void CopyManagedArray(T[] array, IntPtr data)
public static unsafe void DisposeAbiArrayElements((int length, IntPtr data) abi)
{
-#if NET
+#if NET && !NET9_0_OR_GREATER
if (!RuntimeFeature.IsDynamicCodeCompiled)
{
throw new NotSupportedException($"Cannot handle array marshalling for non blittable type '{typeof(T)}'.");
@@ -1286,10 +1321,20 @@ public static unsafe void DisposeAbiArrayElements((int length, IntPtr data) abi)
#endif
var data = (byte*)abi.data.ToPointer();
#pragma warning disable IL3050 // https://github.com/dotnet/runtime/issues/97273
- var abi_element_size = Marshal.SizeOf(AbiType);
+ var abi_element_size =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.SizeOf(AbiType.TypeHandle);
+#else
+ Marshal.SizeOf(AbiType);
+#endif
for (int i = 0; i < abi.length; i++)
{
- var abi_element = Marshal.PtrToStructure((IntPtr)data, AbiType);
+ var abi_element =
+#if NET9_0_OR_GREATER
+ RuntimeHelpers.Box(ref *data, AbiType.TypeHandle);
+#else
+ Marshal.PtrToStructure((IntPtr)data, AbiType);
+#endif
#pragma warning restore IL3050
Marshaler.DisposeAbi(abi_element);
data += abi_element_size;
diff --git a/src/WinRT.Runtime/Projections/IDictionary.net5.cs b/src/WinRT.Runtime/Projections/IDictionary.net5.cs
index 24d7bd85b..f9f38cbe0 100644
--- a/src/WinRT.Runtime/Projections/IDictionary.net5.cs
+++ b/src/WinRT.Runtime/Projections/IDictionary.net5.cs
@@ -300,6 +300,7 @@ unsafe static IDictionaryMethods()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitRcwHelperFallbackIfNeeded()
@@ -1299,6 +1300,7 @@ static IDictionary()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitFallbackCCWVTableIfNeeded()
diff --git a/src/WinRT.Runtime/Projections/IEnumerable.net5.cs b/src/WinRT.Runtime/Projections/IEnumerable.net5.cs
index fa054e4f7..db2b85c68 100644
--- a/src/WinRT.Runtime/Projections/IEnumerable.net5.cs
+++ b/src/WinRT.Runtime/Projections/IEnumerable.net5.cs
@@ -421,6 +421,7 @@ static IEnumerable()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitFallbackCCWVTableIfNeeded()
@@ -606,6 +607,7 @@ unsafe static IEnumeratorMethods()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitRcwHelperFallbackIfNeeded()
@@ -1163,6 +1165,7 @@ static IEnumerator()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitFallbackCCWVTableIfNeeded()
diff --git a/src/WinRT.Runtime/Projections/IList.net5.cs b/src/WinRT.Runtime/Projections/IList.net5.cs
index a077e9284..c58620042 100644
--- a/src/WinRT.Runtime/Projections/IList.net5.cs
+++ b/src/WinRT.Runtime/Projections/IList.net5.cs
@@ -177,6 +177,7 @@ unsafe static IListMethods()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitRcwHelperFallbackIfNeeded()
@@ -1412,6 +1413,7 @@ static IList()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitFallbackCCWVTableIfNeeded()
diff --git a/src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs b/src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs
index 32716d606..a63def4f7 100644
--- a/src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs
+++ b/src/WinRT.Runtime/Projections/IReadOnlyDictionary.net5.cs
@@ -229,6 +229,7 @@ unsafe static IReadOnlyDictionaryMethods()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitRcwHelperFallbackIfNeeded()
@@ -1122,6 +1123,7 @@ static IReadOnlyDictionary()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitFallbackCCWVTableIfNeeded()
diff --git a/src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs b/src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs
index 03e7862a8..185c70acd 100644
--- a/src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs
+++ b/src/WinRT.Runtime/Projections/IReadOnlyList.net5.cs
@@ -114,6 +114,7 @@ internal static unsafe void EnsureInitialized()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitRcwHelperFallbackIfNeeded()
@@ -664,6 +665,7 @@ static IReadOnlyList()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitFallbackCCWVTableIfNeeded()
diff --git a/src/WinRT.Runtime/Projections/KeyValuePair.cs b/src/WinRT.Runtime/Projections/KeyValuePair.cs
index 285f40d34..77d64817a 100644
--- a/src/WinRT.Runtime/Projections/KeyValuePair.cs
+++ b/src/WinRT.Runtime/Projections/KeyValuePair.cs
@@ -80,6 +80,7 @@ static void ThrowNotInitialized()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitRcwHelperFallbackIfNeeded()
@@ -409,6 +410,7 @@ static KeyValuePair()
#endif
#if NET
[UnconditionalSuppressMessage("Trimming", "IL2080", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
+ [UnconditionalSuppressMessage("Trimming", "IL2081", Justification = AttributeMessages.AbiTypesNeverHaveConstructors)]
#endif
[MethodImpl(MethodImplOptions.NoInlining)]
static void InitFallbackCCWVTableIfNeeded()
diff --git a/src/WinRT.Runtime/WinRT.Runtime.csproj b/src/WinRT.Runtime/WinRT.Runtime.csproj
index cffdb38aa..b3fb01d62 100644
--- a/src/WinRT.Runtime/WinRT.Runtime.csproj
+++ b/src/WinRT.Runtime/WinRT.Runtime.csproj
@@ -26,6 +26,9 @@
false
github
+
+
+ $(NoWarn);CS9191
diff --git a/src/build.cmd b/src/build.cmd
index 5249236e3..bef166c7b 100644
--- a/src/build.cmd
+++ b/src/build.cmd
@@ -2,7 +2,7 @@
if /i "%cswinrt_echo%" == "on" @echo on
set CsWinRTBuildNetSDKVersion=8.0.303
-set CsWinRTBuildNet8SDKVersion=8.0.303
+set CsWinRTBuildNet9SDKVersion=9.0.100
set this_dir=%~dp0
:dotnet
@@ -23,16 +23,16 @@ powershell -NoProfile -ExecutionPolicy unrestricted -Command ^
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^
-Version '%CsWinRTBuildNetSDKVersion%' -InstallDir '%DOTNET_ROOT(x86)%' -Architecture 'x86' -DownloadTimeout %DownloadTimeout% ^
-AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet'
-rem Install .NET 8 used to build projection
+rem Install .NET 9 used to build projection
powershell -NoProfile -ExecutionPolicy unrestricted -Command ^
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^
--Version '%CsWinRTBuildNet8SDKVersion%' -InstallDir '%DOTNET_ROOT%' -Architecture 'x64' -DownloadTimeout %DownloadTimeout% ^
+-Version '%CsWinRTBuildNet9SDKVersion%' -InstallDir '%DOTNET_ROOT%' -Architecture 'x64' -DownloadTimeout %DownloadTimeout% ^
-AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet'
powershell -NoProfile -ExecutionPolicy unrestricted -Command ^
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^
--Version '%CsWinRTBuildNet8SDKVersion%' -InstallDir '%DOTNET_ROOT(x86)%' -Architecture 'x86' -DownloadTimeout %DownloadTimeout% ^
+-Version '%CsWinRTBuildNet9SDKVersion%' -InstallDir '%DOTNET_ROOT(x86)%' -Architecture 'x86' -DownloadTimeout %DownloadTimeout% ^
-AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet'
:globaljson
@@ -40,7 +40,7 @@ rem Create global.json for current .NET SDK, and with allowPrerelease=true
set global_json=%this_dir%global.json
echo { > %global_json%
echo "sdk": { >> %global_json%
-echo "version": "%CsWinRTBuildNet8SDKVersion%", >> %global_json%
+echo "version": "%CsWinRTBuildNet9SDKVersion%", >> %global_json%
echo "allowPrerelease": true >> %global_json%
echo } >> %global_json%
echo } >> %global_json%
@@ -329,6 +329,7 @@ set cswinrt_exe=%cswinrt_bin_dir%cswinrt.exe
set interop_winmd=%cswinrt_bin_dir%WinRT.Interop.winmd
set netstandard2_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\netstandard2.0\WinRT.Runtime.dll
set net8_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\net8.0\WinRT.Runtime.dll
+set net9_runtime=%this_dir%WinRT.Runtime\bin\%cswinrt_configuration%\net9.0\WinRT.Runtime.dll
set source_generator=%this_dir%Authoring\WinRT.SourceGenerator\bin\%cswinrt_configuration%\netstandard2.0\WinRT.SourceGenerator.dll
set winrt_host_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll
set winrt_host_resource_%cswinrt_platform%=%this_dir%_build\%cswinrt_platform%\%cswinrt_configuration%\WinRT.Host\bin\WinRT.Host.dll.mui
@@ -337,7 +338,7 @@ set guid_patch=%this_dir%Perf\IIDOptimizer\bin\%cswinrt_configuration%\net8.0\*.
set cswinmd_outpath=%this_dir%Authoring\cswinmd\bin\%cswinrt_configuration%\net8.0
rem Now call pack
echo Creating nuget package
-call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;netstandard2_runtime=%netstandard2_runtime%;net8_runtime=%net8_runtime%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_host_resource_x86=%winrt_host_resource_x86%;winrt_host_resource_x64=%winrt_host_resource_x64%;winrt_host_resource_arm=%winrt_host_resource_arm%;winrt_host_resource_arm64=%winrt_host_resource_arm64%;winrt_shim=%winrt_shim%;guid_patch=%guid_patch% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
+call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;interop_winmd=%interop_winmd%;netstandard2_runtime=%netstandard2_runtime%;net8_runtime=%net8_runtime%;net9_runtime=%net9_runtime%;source_generator=%source_generator%;cswinrt_nuget_version=%cswinrt_version_string%;winrt_host_x86=%winrt_host_x86%;winrt_host_x64=%winrt_host_x64%;winrt_host_arm=%winrt_host_arm%;winrt_host_arm64=%winrt_host_arm64%;winrt_host_resource_x86=%winrt_host_resource_x86%;winrt_host_resource_x64=%winrt_host_resource_x64%;winrt_host_resource_arm=%winrt_host_resource_arm%;winrt_host_resource_arm64=%winrt_host_resource_arm64%;winrt_shim=%winrt_shim%;guid_patch=%guid_patch% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
call :exec %nuget_dir%\nuget pack %this_dir%..\nuget\Microsoft.Windows.CsWinMD.nuspec -Properties cswinmd_outpath=%cswinmd_outpath%;source_generator=%source_generator%;cswinmd_nuget_version=%cswinrt_version_string%; -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed -NoPackageAnalysis
goto :eof