From 93abd28b726398e1a0e0c16f82b3d98654a0f027 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 12 Oct 2023 11:07:05 +0200 Subject: [PATCH 1/8] Switch all projects in solution to .NET 8 --- .github/workflows/dotnet.yml | 32 +++++++++---------- build/Directory.Build.props | 4 +-- global.json | 8 ++--- .../ComputeSharp.Benchmark.csproj | 2 +- samples/ComputeSharp.Benchmark/Program.cs | 2 +- .../ComputeSharp.ImageProcessing.csproj | 2 +- .../ComputeSharp.Sample.FSharp.Shaders.csproj | 2 +- .../ComputeSharp.Sample.FSharp.fsproj | 2 +- .../ComputeSharp.Sample.csproj | 2 +- .../ComputeSharp.SwapChain.Cli.csproj | 2 +- .../ComputeSharp.SwapChain.D2D1.Cli.csproj | 3 +- .../ComputeSharp.SwapChain.WinUI.csproj | 6 ++-- .../{win10-arm64.pubxml => win-arm64.pubxml} | 4 +-- .../{win10-x64.pubxml => win-x64.pubxml} | 4 +-- .../ComputeSharp.SwapChain.csproj | 2 +- .../ComputeSharp.Core.csproj | 2 +- .../ComputeSharp.D2D1.WinUI.csproj | 4 +-- .../ComputeSharp.D2D1.csproj | 2 +- .../ComputeSharp.D3D12MemoryAllocator.csproj | 2 +- src/ComputeSharp.Dxc/ComputeSharp.Dxc.csproj | 2 +- src/ComputeSharp.Pix/ComputeSharp.Pix.csproj | 2 +- .../ComputeSharp.WinUI.csproj | 4 +-- .../Helpers/SwapChainManager.cs | 6 ++-- src/ComputeSharp/ComputeSharp.csproj | 2 +- .../GraphicsDeviceExtensions.Dispatching.cs | 4 ++- .../Extensions/ComputeContextExtensions.cs | 4 ++- src/Directory.Build.targets | 8 ++--- ....D2D1.Tests.AssemblyLevelAttributes.csproj | 2 +- ...teSharp.D2D1.Tests.SourceGenerators.csproj | 2 +- ...lShaderDescriptorOnPixelShaderCodeFixer.cs | 14 ++++---- .../ComputeSharp.D2D1.Tests.csproj | 2 +- .../ComputeSharp.D2D1.WinUI.Tests.csproj | 6 ++-- .../{win10-arm64.pubxml => win-arm64.pubxml} | 2 +- .../{win10-x64.pubxml => win-x64.pubxml} | 2 +- .../ComputeSharp.Dxc.NuGet.csproj | 2 +- .../ComputeSharp.NuGet.csproj | 2 +- .../ComputeSharp.Pix.NuGet.csproj | 2 +- .../ComputeSharp.Tests.DeviceLost.csproj | 2 +- ...arp.Tests.DisableDynamicCompilation.csproj | 2 +- ...ComputeSharp.Tests.GlobalStatements.csproj | 2 +- .../ComputeSharp.Tests.Internals.csproj | 2 +- ...Sharp.Tests.NativeLibrariesResolver.csproj | 2 +- .../NativeLibrariesResolverTestsBase.cs | 14 ++++---- ...ComputeSharp.Tests.SourceGenerators.csproj | 4 +-- .../DiagnosticsTests.cs | 2 +- ...lyzerWithLanguageVersionTest{TAnalyzer}.cs | 2 +- .../ComputeSharp.Tests.csproj | 2 +- 47 files changed, 96 insertions(+), 93 deletions(-) rename samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/{win10-arm64.pubxml => win-arm64.pubxml} (88%) rename samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/{win10-x64.pubxml => win-x64.pubxml} (88%) rename tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/{win10-arm64.pubxml => win-arm64.pubxml} (92%) rename tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/{win10-x64.pubxml => win-x64.pubxml} (92%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 757afabd..7b69968d 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -122,7 +122,7 @@ jobs: - name: Run ComputeSharp.D2D1.Tests.AssemblyLevelAttributes run: dotnet test tests\ComputeSharp.D2D1.Tests.AssemblyLevelAttributes\ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj -c Release -v n -l "console;verbosity=detailed" - # Run the D2D1 source generators tests as well (only on .NET 7, like for the DX12 ones) + # Run the D2D1 source generators tests as well - name: Run ComputeSharp.D2D1.Tests.SourceGenerators run: dotnet test tests\ComputeSharp.D2D1.Tests.SourceGenerators\ComputeSharp.D2D1.Tests.SourceGenerators.csproj -v n -l "console;verbosity=detailed" @@ -165,7 +165,7 @@ jobs: run: > $vs_path = vswhere -latest -products * -requires Microsoft.VisualStudio.Workload.ManagedDesktop -requiresAny -property installationPath; $vstest_path = join-path $vs_path 'Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe'; - & $vstest_path /Platform:x64 tests\ComputeSharp.D2D1.WinUI.Tests\bin\x64\Release\net7.0-windows10.0.22621.0\win10-x64\ComputeSharp.D2D1.WinUI.Tests.build.appxrecipe + & $vstest_path /Platform:x64 tests\ComputeSharp.D2D1.WinUI.Tests\bin\x64\Release\net8.0-windows10.0.22621.0\win-x64\ComputeSharp.D2D1.WinUI.Tests.build.appxrecipe # Run all the local samples to ensure they build and run with no errors run-samples: @@ -177,15 +177,15 @@ jobs: - name: Build and run ComputeSharp.Sample run: > dotnet build samples\ComputeSharp.Sample\ComputeSharp.Sample.csproj -c Release -r win-x64 --no-self-contained -p:Platform=x64 -v n; - samples\ComputeSharp.Sample\bin\x64\Release\net7.0\win-x64\ComputeSharp.Sample.exe + samples\ComputeSharp.Sample\bin\x64\Release\net8.0\win-x64\ComputeSharp.Sample.exe - name: Build and run ComputeSharp.Sample.FSharp run: > dotnet build samples\ComputeSharp.Sample.FSharp\ComputeSharp.Sample.FSharp.fsproj -c Release -r win-x64 --no-self-contained -p:Platform=x64 -v n; - samples\ComputeSharp.Sample.FSharp\bin\x64\Release\net7.0\win-x64\ComputeSharp.Sample.FSharp.exe + samples\ComputeSharp.Sample.FSharp\bin\x64\Release\net8.0\win-x64\ComputeSharp.Sample.FSharp.exe - name: Build and run ComputeSharp.ImageProcessing.csproj run: > dotnet build samples\ComputeSharp.ImageProcessing\ComputeSharp.ImageProcessing.csproj -c Release -r win-x64 --no-self-contained -p:Platform=x64 -v n; - samples\ComputeSharp.ImageProcessing\bin\x64\Release\net7.0\win-x64\ComputeSharp.ImageProcessing.exe + samples\ComputeSharp.ImageProcessing\bin\x64\Release\net8.0\win-x64\ComputeSharp.ImageProcessing.exe # Run the NativeAOT samples as well run-samples-aot: @@ -215,7 +215,7 @@ jobs: - if: matrix.platform == 'x64' name: Run ComputeSharp.SwapChain.Cli (speed) run: > - $process = (Start-Process samples\ComputeSharp.SwapChain.Cli\bin\Release\net7.0\win-x64\publish\computesharp.cli.exe -PassThru); + $process = (Start-Process samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe -PassThru); sleep -Seconds 2; $process.CloseMainWindow() | Out-Null; $process.WaitForExit(); @@ -228,7 +228,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: computesharp.cli.opt-speed.exe - path: samples\ComputeSharp.SwapChain.Cli\bin\Release\net7.0\win-x64\publish\computesharp.cli.exe + path: samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe if-no-files-found: error # Publish the NativeAOT CLI sample (optimized for size, and reflection-free) @@ -244,7 +244,7 @@ jobs: - if: matrix.platform == 'x64' name: Run ComputeSharp.SwapChain.Cli (size) run: > - $process = (Start-Process samples\ComputeSharp.SwapChain.Cli\bin\Release\net7.0\win-x64\publish\computesharp.cli.exe -PassThru); + $process = (Start-Process samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe -PassThru); sleep -Seconds 2; $process.CloseMainWindow() | Out-Null; $process.WaitForExit(); @@ -257,21 +257,21 @@ jobs: uses: actions/upload-artifact@v3 with: name: computesharp.cli.opt-size.exe - path: samples\ComputeSharp.SwapChain.Cli\bin\Release\net7.0\win-x64\publish\computesharp.cli.exe + path: samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe if-no-files-found: error - # Also publish the Win2D sample on .NET 7 (without NativeAOT, see https://github.com/dotnet/runtime/issues/84908) + # Also publish the Win2D sample (without NativeAOT, see https://github.com/dotnet/runtime/issues/84908) - if: matrix.platform == 'x64' name: Publish ComputeSharp.SwapChain.D2D1.Cli run: > msbuild samples\ComputeSharp.SwapChain.D2D1.Cli\ComputeSharp.SwapChain.D2D1.Cli.csproj /restore -t:publish /p:Configuration=Release - /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win10-${{matrix.platform}} /p:PublishSingleFile=True /p:SelfContained=True /p:PublishTrimmed=True + /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}} /p:PublishSingleFile=True /p:SelfContained=True /p:PublishTrimmed=True # Just like for the DX12 sample, run it on x64 to validate it works correctly - if: matrix.platform == 'x64' name: Run ComputeSharp.SwapChain.D2D1.Cli run: > - $process = (Start-Process samples\ComputeSharp.SwapChain.D2D1.Cli\bin\x64\Release\net7.0-windows10.0.22621\win10-x64\publish\computesharp.d2d1.cli.exe -PassThru); + $process = (Start-Process samples\ComputeSharp.SwapChain.D2D1.Cli\bin\x64\Release\net8.0-windows10.0.22621\win-x64\publish\computesharp.d2d1.cli.exe -PassThru); sleep -Seconds 2; $process.CloseMainWindow() | Out-Null; $process.WaitForExit(); @@ -285,7 +285,7 @@ jobs: $env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_AOT='true'; git clean -fdx; msbuild samples\ComputeSharp.SwapChain.D2D1.Cli\ComputeSharp.SwapChain.D2D1.Cli.csproj /restore -t:publish /p:Configuration=Release - /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win10-${{matrix.platform}} + /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}} # Download the NuGet packages generated in the previous job and use them # to build and run the sample project referencing them. This is used as @@ -321,17 +321,17 @@ jobs: run: > $env:COMPUTESHARP_NUGET_TESTS_PUBLISH_AOT='true'; dotnet publish tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -c Release -r win-x64 -v n; - tests\ComputeSharp.NuGet\bin\Release\net7.0\win-x64\publish\ComputeSharp.NuGet.exe + tests\ComputeSharp.NuGet\bin\Release\net8.0\win-x64\publish\ComputeSharp.NuGet.exe - name: Publish and run ComputeSharp.Dxc.NuGet with NativeAOT run: > $env:COMPUTESHARP_NUGET_TESTS_PUBLISH_AOT='true'; dotnet publish tests\ComputeSharp.Dxc.NuGet\ComputeSharp.Dxc.NuGet.csproj -c Release -r win-x64 -v n; - tests\ComputeSharp.Dxc.NuGet\bin\Release\net7.0\win-x64\publish\ComputeSharp.Dxc.NuGet.exe + tests\ComputeSharp.Dxc.NuGet\bin\Release\net8.0\win-x64\publish\ComputeSharp.Dxc.NuGet.exe - name: Publish and run ComputeSharp.Pix.NuGet with NativeAOT run: > $env:COMPUTESHARP_NUGET_TESTS_PUBLISH_AOT='true'; dotnet publish tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj -c Release -r win-x64 -v n; - tests\ComputeSharp.Pix.NuGet\bin\Release\net7.0\win-x64\publish\ComputeSharp.Pix.NuGet.exe + tests\ComputeSharp.Pix.NuGet\bin\Release\net8.0\win-x64\publish\ComputeSharp.Pix.NuGet.exe # Publish the packages to GitHub packages publish-nightlies-github: diff --git a/build/Directory.Build.props b/build/Directory.Build.props index d0778fe0..ed67b75c 100644 --- a/build/Directory.Build.props +++ b/build/Directory.Build.props @@ -1,7 +1,7 @@ true - 11.0 + preview enable true @@ -46,7 +46,7 @@ This is used eg. to replace Unsafe.SizeOf() calls with just sizeof(T). The warning is not necessary since in order to use these APIs the caller already has to be in an unsafe context. --> - $(NoWarn);CS8500 + $(NoWarn);CS8500;IDE0290;IDE0305;IDE0028;IDE0300;IDE0301;IDE0302 diff --git a/global.json b/global.json index 354fa7a0..4a7386d5 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,7 @@ { - "msbuild-sdks": { - "MSBuild.Sdk.Extras": "3.0.38" - }, "sdk": { - "version": "7.0.202", - "rollForward": "latestFeature" + "version": "8.0.100-rc.2.23502.2", + "rollForward": "latestFeature", + "allowPrerelease": true } } \ No newline at end of file diff --git a/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj b/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj index 4516f42d..1bf50eae 100644 --- a/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj +++ b/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 $(NoWarn);CA1416 diff --git a/samples/ComputeSharp.Benchmark/Program.cs b/samples/ComputeSharp.Benchmark/Program.cs index 3a7a3ead..ee6b7824 100644 --- a/samples/ComputeSharp.Benchmark/Program.cs +++ b/samples/ComputeSharp.Benchmark/Program.cs @@ -6,6 +6,6 @@ using BenchmarkDotNet.Running; // ================ // In order to run this benchmark, switch to Release mode and either run select // it as the startup project for the solution and run it without the debugger -// (CTRL + F5), or compile it and then go to its bin\Release\net7.0 folder, +// (CTRL + F5), or compile it and then go to its bin\Release\net8.0 folder, // open a cmd prompt and run "dotnet ComputeSharp.Benchmark.dll". BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args); \ No newline at end of file diff --git a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj index a00c93dc..2a4b08df 100644 --- a/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj +++ b/samples/ComputeSharp.ImageProcessing/ComputeSharp.ImageProcessing.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 AnyCPU;x64;ARM64 $(NoWarn);CA1416 diff --git a/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj b/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj index 9a713f4e..fe52e4bf 100644 --- a/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj +++ b/samples/ComputeSharp.Sample.FSharp.Shaders/ComputeSharp.Sample.FSharp.Shaders.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 $(NoWarn);CA1416 diff --git a/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj b/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj index ffca44c3..1fdabde1 100644 --- a/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj +++ b/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 AnyCPU;x64;ARM64 5.0 diff --git a/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj b/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj index 30f225f3..99e0d996 100644 --- a/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj +++ b/samples/ComputeSharp.Sample/ComputeSharp.Sample.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 AnyCPU;x64;ARM64 $(NoWarn);CA1416 diff --git a/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj b/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj index a4f7e0ed..339b0041 100644 --- a/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj +++ b/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj @@ -8,7 +8,7 @@ --> Exe WinExe - net7.0 + net8.0 x64;ARM64 $(NoWarn);CA1416 computesharp.cli diff --git a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj index fe69705a..6bd1fcbd 100644 --- a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj +++ b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj @@ -2,9 +2,10 @@ Exe WinExe - net7.0-windows10.0.22621 + net8.0-windows10.0.22621 app.manifest x64;ARM64 + win-x64;win-arm64 $(NoWarn);IDE0065 computesharp.d2d1.cli ..\..\assets\icon.ico diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj index 80d9d0b0..d8f6efbb 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj @@ -1,13 +1,13 @@ WinExe - net7.0-windows10.0.22621.0 + net8.0-windows10.0.22621.0 10.0.17763.0 ComputeSharp.SwapChain.WinUI app.manifest x64;arm64 - win10-x64;win10-arm64 - win10-$(Platform).pubxml + win-x64;win-arm64 + win-$(Platform).pubxml true true diff --git a/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win10-arm64.pubxml b/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-arm64.pubxml similarity index 88% rename from samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win10-arm64.pubxml rename to samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-arm64.pubxml index f1f86f87..e058a950 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win10-arm64.pubxml +++ b/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-arm64.pubxml @@ -1,10 +1,10 @@ - + FileSystem arm64 - win10-arm64 + win-arm64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False diff --git a/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win10-x64.pubxml b/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-x64.pubxml similarity index 88% rename from samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win10-x64.pubxml rename to samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-x64.pubxml index 58a18b9a..69645733 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win10-x64.pubxml +++ b/samples/ComputeSharp.SwapChain.WinUI/Properties/PublishProfiles/win-x64.pubxml @@ -1,10 +1,10 @@ - + FileSystem x64 - win10-x64 + win-x64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False diff --git a/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj b/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj index 67698b89..939f6f61 100644 --- a/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj +++ b/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 x64;ARM64 $(NoWarn);CA1416;IDE0210 diff --git a/src/ComputeSharp.Core/ComputeSharp.Core.csproj b/src/ComputeSharp.Core/ComputeSharp.Core.csproj index b427ebf4..7c525455 100644 --- a/src/ComputeSharp.Core/ComputeSharp.Core.csproj +++ b/src/ComputeSharp.Core/ComputeSharp.Core.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 diff --git a/src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.csproj b/src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.csproj index 19b6426a..5767bf8f 100644 --- a/src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.csproj +++ b/src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.csproj @@ -1,9 +1,9 @@ - net7.0-windows10.0.22621.0 + net8.0-windows10.0.22621.0 10.0.17763.0 x64;ARM64 - win10-x64;win10-arm64 + win-x64;win-arm64 diff --git a/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj b/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj index 72c2891b..389c3ceb 100644 --- a/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj +++ b/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 windows6.1 diff --git a/src/ComputeSharp.D3D12MemoryAllocator/ComputeSharp.D3D12MemoryAllocator.csproj b/src/ComputeSharp.D3D12MemoryAllocator/ComputeSharp.D3D12MemoryAllocator.csproj index 09d28dcf..56c9f69a 100644 --- a/src/ComputeSharp.D3D12MemoryAllocator/ComputeSharp.D3D12MemoryAllocator.csproj +++ b/src/ComputeSharp.D3D12MemoryAllocator/ComputeSharp.D3D12MemoryAllocator.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 windows6.2 diff --git a/src/ComputeSharp.Dxc/ComputeSharp.Dxc.csproj b/src/ComputeSharp.Dxc/ComputeSharp.Dxc.csproj index 34cdcce5..eb867431 100644 --- a/src/ComputeSharp.Dxc/ComputeSharp.Dxc.csproj +++ b/src/ComputeSharp.Dxc/ComputeSharp.Dxc.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 AnyCPU;x64;ARM64 windows6.2 diff --git a/src/ComputeSharp.Pix/ComputeSharp.Pix.csproj b/src/ComputeSharp.Pix/ComputeSharp.Pix.csproj index 718387a5..815b62c2 100644 --- a/src/ComputeSharp.Pix/ComputeSharp.Pix.csproj +++ b/src/ComputeSharp.Pix/ComputeSharp.Pix.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 AnyCPU;x64;ARM64 windows6.2 diff --git a/src/ComputeSharp.WinUI/ComputeSharp.WinUI.csproj b/src/ComputeSharp.WinUI/ComputeSharp.WinUI.csproj index 746a640c..c8f2a068 100644 --- a/src/ComputeSharp.WinUI/ComputeSharp.WinUI.csproj +++ b/src/ComputeSharp.WinUI/ComputeSharp.WinUI.csproj @@ -1,9 +1,9 @@ - net7.0-windows10.0.22621.0 + net8.0-windows10.0.22621.0 10.0.17763.0 x64;ARM64 - win10-x64;win10-arm64 + win-x64;win-arm64 diff --git a/src/ComputeSharp.WinUI/Helpers/SwapChainManager.cs b/src/ComputeSharp.WinUI/Helpers/SwapChainManager.cs index d294de5e..f886842b 100644 --- a/src/ComputeSharp.WinUI/Helpers/SwapChainManager.cs +++ b/src/ComputeSharp.WinUI/Helpers/SwapChainManager.cs @@ -223,9 +223,9 @@ internal sealed unsafe partial class SwapChainManager : ReferenceTracked swapChainPanel.Attach((IUnknown*)((IWinRTObject)owner).NativeObject.GetRef()); - swapChainPanel.CopyTo( - (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(new Guid(0x63AAD0B8, 0x7C24, 0x40FF, 0x85, 0xA8, 0x64, 0x0D, 0x94, 0x4C, 0xC3, 0x25))), - (void**)swapChainPanelNative).Assert(); + Guid guid = new(0x63AAD0B8, 0x7C24, 0x40FF, 0x85, 0xA8, 0x64, 0x0D, 0x94, 0x4C, 0xC3, 0x25); + + swapChainPanel.CopyTo(&guid, (void**)swapChainPanelNative).Assert(); } // Get the underlying ID3D12Device in use diff --git a/src/ComputeSharp/ComputeSharp.csproj b/src/ComputeSharp/ComputeSharp.csproj index fd476db1..7bd5aa51 100644 --- a/src/ComputeSharp/ComputeSharp.csproj +++ b/src/ComputeSharp/ComputeSharp.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 windows6.2 diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs index 74420060..b0ebb8fd 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs @@ -80,7 +80,9 @@ public static partial class GraphicsDeviceExtensions using ComputeContext context = device.CreateComputeContext(); - context.Run(texture, ref Unsafe.AsRef(default(T))); + Unsafe.SkipInit(out T shader); + + context.Run(texture, ref shader); } /// diff --git a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs index cc33081e..8e38f4a6 100644 --- a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs @@ -532,7 +532,9 @@ public static class ComputeContextExtensions { default(ArgumentNullException).ThrowIfNull(texture); - context.Run(texture, ref Unsafe.AsRef(default(T))); + Unsafe.SkipInit(out T shader); + + context.Run(texture, ref shader); } /// diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 045b0775..dc45e97c 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -48,15 +48,15 @@ properties set below, because if that is the case the trimmable attribute will be set but the analyzers will not run, so warnings will be skipped. --> - + true true true true - - + + @@ -71,7 +71,7 @@ - + <_Parameter1>false diff --git a/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj b/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj index 4151b2fe..232fc4a1 100644 --- a/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj +++ b/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj index 8be63b1d..f4c9441a 100644 --- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj +++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 https://api.nuget.org/v3/index.json; https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json; diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer.cs b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer.cs index 461490bc..ef4375c8 100644 --- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer.cs +++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer.cs @@ -40,7 +40,7 @@ public class Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer { TestCode = original, FixedCode = @fixed, - ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + ReferenceAssemblies = ReferenceAssemblies.Net.Net80 }; test.TestState.AdditionalReferences.Add(typeof(Core::ComputeSharp.Float4).Assembly); @@ -101,7 +101,7 @@ public class Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer { TestCode = original, FixedCode = @fixed, - ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + ReferenceAssemblies = ReferenceAssemblies.Net.Net80 }; test.TestState.AdditionalReferences.Add(typeof(Core::ComputeSharp.Float4).Assembly); @@ -135,7 +135,7 @@ public class Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer { TestCode = original, FixedCode = @fixed, - ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + ReferenceAssemblies = ReferenceAssemblies.Net.Net80 }; test.TestState.AdditionalReferences.Add(typeof(Core::ComputeSharp.Float4).Assembly); @@ -193,7 +193,7 @@ public class Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer { TestCode = original, FixedCode = @fixed, - ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + ReferenceAssemblies = ReferenceAssemblies.Net.Net80 }; test.TestState.AdditionalReferences.Add(typeof(Core::ComputeSharp.Float4).Assembly); @@ -233,7 +233,7 @@ public class Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer { TestCode = original, FixedCode = @fixed, - ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + ReferenceAssemblies = ReferenceAssemblies.Net.Net80 }; test.TestState.AdditionalReferences.Add(typeof(Core::ComputeSharp.Float4).Assembly); @@ -285,7 +285,7 @@ public class Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer { TestCode = original, FixedCode = @fixed, - ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + ReferenceAssemblies = ReferenceAssemblies.Net.Net80 }; test.TestState.AdditionalReferences.Add(typeof(Core::ComputeSharp.Float4).Assembly); @@ -349,7 +349,7 @@ public class Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer { TestCode = original, FixedCode = @fixed, - ReferenceAssemblies = ReferenceAssemblies.Net.Net70 + ReferenceAssemblies = ReferenceAssemblies.Net.Net80 }; test.TestState.AdditionalReferences.Add(typeof(Core::ComputeSharp.Float4).Assembly); diff --git a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj index 4d604cd5..62d411f3 100644 --- a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj +++ b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj b/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj index ce978c9f..935f6efc 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj +++ b/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj @@ -1,12 +1,12 @@ WinExe - net7.0-windows10.0.22621.0 + net8.0-windows10.0.22621.0 10.0.17763.0 app.manifest x64;ARM64 - win10-x64;win10-arm64 - win10-$(Platform).pubxml + win-x64;win-arm64 + win-$(Platform).pubxml true true diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win10-arm64.pubxml b/tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win-arm64.pubxml similarity index 92% rename from tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win10-arm64.pubxml rename to tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win-arm64.pubxml index 13886493..edffda94 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win10-arm64.pubxml +++ b/tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win-arm64.pubxml @@ -3,7 +3,7 @@ FileSystem ARM64 - win10-arm64 + win-arm64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true false diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win10-x64.pubxml b/tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win-x64.pubxml similarity index 92% rename from tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win10-x64.pubxml rename to tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win-x64.pubxml index f76db08c..55050ee9 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win10-x64.pubxml +++ b/tests/ComputeSharp.D2D1.WinUI.Tests/Properties/PublishProfiles/win-x64.pubxml @@ -3,7 +3,7 @@ FileSystem x64 - win10-x64 + win-x64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true false diff --git a/tests/ComputeSharp.Dxc.NuGet/ComputeSharp.Dxc.NuGet.csproj b/tests/ComputeSharp.Dxc.NuGet/ComputeSharp.Dxc.NuGet.csproj index 79096162..f5e2329c 100644 --- a/tests/ComputeSharp.Dxc.NuGet/ComputeSharp.Dxc.NuGet.csproj +++ b/tests/ComputeSharp.Dxc.NuGet/ComputeSharp.Dxc.NuGet.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 AnyCPU;x64;ARM64 true $(NoWarn);IL2026 diff --git a/tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj b/tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj index 69cd8b49..e71be9bb 100644 --- a/tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj +++ b/tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 AnyCPU;x64;ARM64 true $(NoWarn);IL2026 diff --git a/tests/ComputeSharp.Pix.NuGet/ComputeSharp.Pix.NuGet.csproj b/tests/ComputeSharp.Pix.NuGet/ComputeSharp.Pix.NuGet.csproj index 458a19ca..f66737a7 100644 --- a/tests/ComputeSharp.Pix.NuGet/ComputeSharp.Pix.NuGet.csproj +++ b/tests/ComputeSharp.Pix.NuGet/ComputeSharp.Pix.NuGet.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 AnyCPU;x64;ARM64 true $(NoWarn);IL2026 diff --git a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj index 482b4a6a..a9a2bf25 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj +++ b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 AnyCPU;x64;ARM64 diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj index f67d65da..50027a50 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 AnyCPU;x64;ARM64 diff --git a/tests/ComputeSharp.Tests.GlobalStatements/ComputeSharp.Tests.GlobalStatements.csproj b/tests/ComputeSharp.Tests.GlobalStatements/ComputeSharp.Tests.GlobalStatements.csproj index cdc76e3b..79d4b0fc 100644 --- a/tests/ComputeSharp.Tests.GlobalStatements/ComputeSharp.Tests.GlobalStatements.csproj +++ b/tests/ComputeSharp.Tests.GlobalStatements/ComputeSharp.Tests.GlobalStatements.csproj @@ -1,7 +1,7 @@ Exe - net7.0 + net8.0 AnyCPU;x64;ARM64 enable diff --git a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj index 8c05c3c4..7f43aa89 100644 --- a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj +++ b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 AnyCPU;x64;ARM64 diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj b/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj index 169f66d6..b351a8e6 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Helpers/NativeLibrariesResolverTestsBase.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/Helpers/NativeLibrariesResolverTestsBase.cs index 065b7f1f..63feda49 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Helpers/NativeLibrariesResolverTestsBase.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/Helpers/NativeLibrariesResolverTestsBase.cs @@ -55,7 +55,7 @@ public abstract class NativeLibrariesResolverTestsBase CleanSampleProject(configuration, rid); BuildSampleProject(configuration, rid); - string realtivePathToDll = Path.Combine("bin", $"{configuration}", "net7.0", $"{ToDirectory(rid)}", $"{SampleProjectName}.dll"); + string realtivePathToDll = Path.Combine("bin", $"{configuration}", "net8.0", $"{ToDirectory(rid)}", $"{SampleProjectName}.dll"); Assert.AreEqual(0, Exec(SampleProjectDirectory, "dotnet", realtivePathToDll)); } @@ -70,7 +70,7 @@ public abstract class NativeLibrariesResolverTestsBase CleanSampleProject(configuration, rid); BuildSampleProject(configuration, rid); - string pathToDllDirectory = Path.Combine(SampleProjectDirectory, "bin", $"{configuration}", "net7.0", $"{ToDirectory(rid)}"); + string pathToDllDirectory = Path.Combine(SampleProjectDirectory, "bin", $"{configuration}", "net8.0", $"{ToDirectory(rid)}"); Assert.AreEqual(0, Exec(pathToDllDirectory, "dotnet", $"{SampleProjectName}.dll")); } @@ -85,7 +85,7 @@ public abstract class NativeLibrariesResolverTestsBase CleanSampleProject(configuration, rid); BuildSampleProject(configuration, rid); - string relativePathToAppHost = Path.Combine("bin", $"{configuration}", "net7.0", $"{ToDirectory(rid)}", $"{SampleProjectName}.exe"); + string relativePathToAppHost = Path.Combine("bin", $"{configuration}", "net8.0", $"{ToDirectory(rid)}", $"{SampleProjectName}.exe"); Assert.AreEqual(0, Exec(SampleProjectDirectory, relativePathToAppHost, "")); } @@ -100,7 +100,7 @@ public abstract class NativeLibrariesResolverTestsBase CleanSampleProject(configuration, rid); BuildSampleProject(configuration, rid); - string pathToAppHostDirectory = Path.Combine(SampleProjectDirectory, "bin", $"{configuration}", "net7.0", $"{ToDirectory(rid)}"); + string pathToAppHostDirectory = Path.Combine(SampleProjectDirectory, "bin", $"{configuration}", "net8.0", $"{ToDirectory(rid)}"); Assert.AreEqual(0, Exec(pathToAppHostDirectory, $"{SampleProjectName}.exe", "")); } @@ -120,7 +120,7 @@ public abstract class NativeLibrariesResolverTestsBase _ = Exec(SampleProjectDirectory, "dotnet", $"publish -c Release -r win-x64 {ToOption(publishMode)} {ToOption(deploymentMode)} {ToOption(nativeLibsDeploymentMode)} /bl"); - string pathToAppHost = Path.Combine("bin", $"Release", "net7.0", "win-x64", "publish", $"{SampleProjectName}.exe"); + string pathToAppHost = Path.Combine("bin", $"Release", "net8.0", "win-x64", "publish", $"{SampleProjectName}.exe"); Assert.AreEqual(0, Exec(SampleProjectDirectory, pathToAppHost, "")); } @@ -278,8 +278,8 @@ public enum PublishMode } /// -/// Indicates how should the application be packaged. Notably, these tests employ .NET 7 style SingleFile, -/// aka SuperHost. It does not affect native libraries packaging in .NET 7, but may in the future. +/// Indicates how should the application be packaged. Notably, these tests employ .NET 8 style SingleFile, +/// aka SuperHost. It does not affect native libraries packaging in .NET 8, but may in the future. /// public enum DeploymentMode { diff --git a/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj b/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj index 361b6d24..59015e93 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj +++ b/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 https://api.nuget.org/v3/index.json; https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json; @@ -8,7 +8,7 @@ - + diff --git a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs index 9c12234f..98c6bacc 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs +++ b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs @@ -1433,7 +1433,7 @@ public class DiagnosticsTests }; // Get all assembly references for the loaded assemblies (easy way to pull in all necessary dependencies) - IEnumerable metadataReferences = Net70.References.All.Concat(additionalReferences); + IEnumerable metadataReferences = Net80.References.All.Concat(additionalReferences); // Parse the source text (C# 11) SyntaxTree sourceTree = CSharpSyntaxTree.ParseText( diff --git a/tests/ComputeSharp.Tests.SourceGenerators/Helpers/CSharpAnalyzerWithLanguageVersionTest{TAnalyzer}.cs b/tests/ComputeSharp.Tests.SourceGenerators/Helpers/CSharpAnalyzerWithLanguageVersionTest{TAnalyzer}.cs index 7988be13..44e3afb6 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/Helpers/CSharpAnalyzerWithLanguageVersionTest{TAnalyzer}.cs +++ b/tests/ComputeSharp.Tests.SourceGenerators/Helpers/CSharpAnalyzerWithLanguageVersionTest{TAnalyzer}.cs @@ -46,7 +46,7 @@ internal sealed class CSharpAnalyzerWithLanguageVersionTest : CSharpA { CSharpAnalyzerWithLanguageVersionTest test = new(languageVersion) { TestCode = source }; - test.TestState.ReferenceAssemblies = ReferenceAssemblies.Net.Net70; + test.TestState.ReferenceAssemblies = ReferenceAssemblies.Net.Net80; test.TestState.AdditionalReferences.Add(MetadataReference.CreateFromFile(typeof(Core::ComputeSharp.Hlsl).Assembly.Location)); test.TestState.AdditionalReferences.Add(MetadataReference.CreateFromFile(typeof(D3D12::ComputeSharp.IComputeShader).Assembly.Location)); diff --git a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj index 66e8a272..14998b76 100644 --- a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj +++ b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 AnyCPU;x64;ARM64 From a68497c067c520ac62e877621d5cccf002b651a6 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 12 Oct 2023 11:12:12 +0200 Subject: [PATCH 2/8] Update NativeAOT configuration for .NET 8 --- .../ComputeSharp.SwapChain.Cli.csproj | 9 ++++----- .../ComputeSharp.SwapChain.D2D1.Cli.csproj | 3 ++- src/Directory.Build.targets | 7 ++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj b/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj index 339b0041..92362d83 100644 --- a/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj +++ b/samples/ComputeSharp.SwapChain.Cli/ComputeSharp.SwapChain.Cli.csproj @@ -26,14 +26,13 @@ --> true - false true true + false + Size + Speed true - false true - Size - Speed - + diff --git a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj index 6bd1fcbd..4446fe58 100644 --- a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj +++ b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj @@ -22,7 +22,8 @@ true true true - Speed + false + Speed $(NoWarn);IL3053 diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index dc45e97c..a19207fa 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -43,16 +43,13 @@ - true - true - true - true + true From 1a66d33311bd09e3f3192fca51f6619f1455d70a Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 14 Nov 2023 20:57:15 +0100 Subject: [PATCH 3/8] Switch to .NET 8 stable SDK --- build/Directory.Build.props | 2 +- global.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/Directory.Build.props b/build/Directory.Build.props index ed67b75c..425e9414 100644 --- a/build/Directory.Build.props +++ b/build/Directory.Build.props @@ -1,7 +1,7 @@ true - preview + 12.0 enable true diff --git a/global.json b/global.json index 4a7386d5..789bff3b 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "8.0.100-rc.2.23502.2", + "version": "8.0.100", "rollForward": "latestFeature", - "allowPrerelease": true + "allowPrerelease": false } } \ No newline at end of file From ca079e15c0e4d9f46bc4b162a91ec8446c446e1b Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 15 Nov 2023 00:44:36 +0100 Subject: [PATCH 4/8] Update test and sample NuGet packages to latest stable --- samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj | 2 +- .../ComputeSharp.Sample.FSharp.fsproj | 4 ++-- .../ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj | 2 +- .../ComputeSharp.D2D1.Tests.SourceGenerators.csproj | 2 +- tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj | 2 +- .../ComputeSharp.D2D1.WinUI.Tests.csproj | 2 +- .../ComputeSharp.Tests.DeviceLost.csproj | 2 +- .../ComputeSharp.Tests.DisableDynamicCompilation.csproj | 2 +- .../ComputeSharp.Tests.Internals.csproj | 2 +- .../ComputeSharp.Tests.NativeLibrariesResolver.csproj | 2 +- .../ComputeSharp.Tests.SourceGenerators.csproj | 2 +- tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj b/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj index 1bf50eae..a7bf66c6 100644 --- a/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj +++ b/samples/ComputeSharp.Benchmark/ComputeSharp.Benchmark.csproj @@ -19,7 +19,7 @@ - + diff --git a/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj b/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj index 1fdabde1..cbf99684 100644 --- a/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj +++ b/samples/ComputeSharp.Sample.FSharp/ComputeSharp.Sample.FSharp.fsproj @@ -3,12 +3,12 @@ Exe net8.0 + 8.0 AnyCPU;x64;ARM64 - 5.0 - + diff --git a/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj b/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj index 232fc4a1..dfca8e31 100644 --- a/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj +++ b/tests/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes/ComputeSharp.D2D1.Tests.AssemblyLevelAttributes.csproj @@ -4,7 +4,7 @@ - + diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj index f4c9441a..4bec77f9 100644 --- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj +++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/ComputeSharp.D2D1.Tests.SourceGenerators.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj index 62d411f3..a3fffde8 100644 --- a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj +++ b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj b/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj index 935f6efc..ae3d7cdf 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj +++ b/tests/ComputeSharp.D2D1.WinUI.Tests/ComputeSharp.D2D1.WinUI.Tests.csproj @@ -56,7 +56,7 @@ - + diff --git a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj index a9a2bf25..14865aeb 100644 --- a/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj +++ b/tests/ComputeSharp.Tests.DeviceLost/ComputeSharp.Tests.DeviceLost.csproj @@ -11,7 +11,7 @@ - + diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj index 50027a50..be407503 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj @@ -6,7 +6,7 @@ - + diff --git a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj index 7f43aa89..ccba038a 100644 --- a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj +++ b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj @@ -6,7 +6,7 @@ - + diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj b/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj index b351a8e6..9d09cce1 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj @@ -4,7 +4,7 @@ - + diff --git a/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj b/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj index 59015e93..97bfd004 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj +++ b/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj @@ -10,7 +10,7 @@ - + diff --git a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj index 14998b76..87eb5ef4 100644 --- a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj +++ b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj @@ -12,7 +12,7 @@ - + From b1b724763c77aeaf917424a434e0fb7e4421263d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 20 Nov 2023 10:40:46 +0100 Subject: [PATCH 5/8] Add as a temporary workaround for Win2D --- .../ComputeSharp.SwapChain.D2D1.Cli.csproj | 3 +++ .../ComputeSharp.SwapChain.WinUI.csproj | 17 +++++++++++++++-- .../ComputeSharp.D2D1.WinUI.Tests.csproj | 6 ++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj index 4446fe58..2602e247 100644 --- a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj +++ b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj @@ -9,6 +9,9 @@ $(NoWarn);IDE0065 computesharp.d2d1.cli ..\..\assets\icon.ico + + + true diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj index d8f6efbb..274b6bdc 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj @@ -3,13 +3,15 @@ WinExe net8.0-windows10.0.22621.0 10.0.17763.0 - ComputeSharp.SwapChain.WinUI app.manifest x64;arm64 win-x64;win-arm64 win-$(Platform).pubxml true true + + + true @@ -26,12 +28,23 @@ + + + + + + + - + true @@ -56,6 +59,9 @@ + + + From cf8f329ef9f7184d5a4d4555959150ce5320c31e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 20 Nov 2023 16:47:48 +0100 Subject: [PATCH 6/8] Temporarily disable reflection-free mode in tests --- .github/workflows/dotnet.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7b69968d..e5923091 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -231,12 +231,13 @@ jobs: path: samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe if-no-files-found: error - # Publish the NativeAOT CLI sample (optimized for size, and reflection-free) + # Publish the NativeAOT CLI sample (optimized for size, and reflection-free). + # Temporarily skip COMPUTESHARP_SWAPCHAIN_CLI_DISABLE_REFLECTION unti code is + # refactored to replace typeof(T).GUID with hardcoded IIDs, or it won't work. - name: Publish ComputeSharp.SwapChain.Cli with NativeAOT (size) run: > $env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true'; $env:COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED='true'; - $env:COMPUTESHARP_SWAPCHAIN_CLI_DISABLE_REFLECTION='true'; git clean -fdx; dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -c Release -r win-${{matrix.platform}} -v n From e821b1da2d6dfe47ea1c66742a44dcca940da52e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 20 Nov 2023 17:33:25 +0100 Subject: [PATCH 7/8] Configure sample publishing from .csproj file --- .github/workflows/dotnet.yml | 7 +++++-- .../ComputeSharp.SwapChain.D2D1.Cli.csproj | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e5923091..62652467 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -265,8 +265,10 @@ jobs: - if: matrix.platform == 'x64' name: Publish ComputeSharp.SwapChain.D2D1.Cli run: > - msbuild samples\ComputeSharp.SwapChain.D2D1.Cli\ComputeSharp.SwapChain.D2D1.Cli.csproj /restore -t:publish /p:Configuration=Release - /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}} /p:PublishSingleFile=True /p:SelfContained=True /p:PublishTrimmed=True + $env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_R2R='true'; + $env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_AOT='false'; + msbuild samples\ComputeSharp.SwapChain.D2D1.Cli\ComputeSharp.SwapChain.D2D1.Cli.csproj /restore -t:publish + /p:Configuration=Release /p:Platform=${{matrix.platform}} /p:RuntimeIdentifier=win-${{matrix.platform}} # Just like for the DX12 sample, run it on x64 to validate it works correctly - if: matrix.platform == 'x64' @@ -283,6 +285,7 @@ jobs: - if: matrix.platform == 'x64' name: Publish ComputeSharp.SwapChain.D2D1.Cli with NativeAOT run: > + $env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_R2R='false'; $env:COMPUTESHARP_SWAPCHAIN_D2D1_PUBLISH_AOT='true'; git clean -fdx; msbuild samples\ComputeSharp.SwapChain.D2D1.Cli\ComputeSharp.SwapChain.D2D1.Cli.csproj /restore -t:publish /p:Configuration=Release diff --git a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj index 2602e247..ae847368 100644 --- a/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj +++ b/samples/ComputeSharp.SwapChain.D2D1.Cli/ComputeSharp.SwapChain.D2D1.Cli.csproj @@ -20,6 +20,14 @@ $(NoWarn);IL2104;IL2026 + + + true + true + true + true + + true From 93167a6e1b106c0c1076e767c65c7d9797bcffd0 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 20 Nov 2023 19:28:34 +0100 Subject: [PATCH 8/8] Update test to work around CsWinRT marshalling issue See https://github.com/microsoft/CsWinRT/issues/1393 --- .../Tests/CanvasEffectTests.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/CanvasEffectTests.cs b/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/CanvasEffectTests.cs index ec58ee95..25e1e08c 100644 --- a/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/CanvasEffectTests.cs +++ b/tests/ComputeSharp.D2D1.WinUI.Tests/Tests/CanvasEffectTests.cs @@ -90,9 +90,11 @@ public partial class CanvasEffectTests } [TestMethod] - [ExpectedException(typeof(InvalidOperationException))] + [ExpectedException(typeof(Exception), AllowDerivedTypes = true)] public void CanvasEffect_EffectNotRegisteringAnOutputNode() { + const int COR_E_INVALIDOPERATION = unchecked((int)0x80131509); + EffectNotRegisteringAnOutputNode effect = new(); try @@ -102,8 +104,14 @@ public partial class CanvasEffectTests drawingSession.DrawImage(effect); } - catch + catch (Exception e) { + // Note: this test should ideally expect and catch an InvalidOperationException, as that's the exception + // type thrown by CanvasEffect. But it seems that CsWinRT isn't correctly forwarding the exception type + // in this case, and it ends up only throwing a COMException on the managed side. To work around this in + // this test, we can just catch a generic Exception and manually verify that the HRESULT is a match. + // See https://github.com/microsoft/CsWinRT/issues/1393 (and ideally update the test once that's fixed). + Assert.AreEqual(COR_E_INVALIDOPERATION, e.HResult); Assert.IsTrue(effect.WasConfigureEffectGraphCalled); throw;