Closed inforithmics closed 2 years ago
Here the Binlog Output Uno.Skia.Wpf.binlog.zip It seems an msbuild problem because csc compiler and sourcegenerator seem to work.
1) Steps tried Disabling Resharper, stll does not work. Changing Microsoft.Net.Compilers.Toolset Version still does not work (newer Prerelease or older Release Version) Using Visual Studio 2022 (instead of Preview) still does not work.
I found out the Reason and a Minimal Repro. The reason is that Uno.Skia.Wpf is not compatible with .NET SDK 6.0.302 with .NET SDK 6.0.301 it works.
Steps to reproduce.
Make Uno Default Project 1) dotnet new uno unoapp-uwp-net6 Bug 2) add global.json does not work
{
"sdk": {
"allowPrerelease": false,
"version": "6.0.302"
},
"tools": {
"dotnet": "6.0.302"
}
}
3) add global.json does work
{
"sdk": {
"allowPrerelease": false,
"version": "6.0.301"
},
"tools": {
"dotnet": "6.0.301"
}
}
So the Workaround is using .NET SDK 6.0.301 which works and .NET SDK 6.0.302 does not work.
Thanks for the investigation! There may be a unknown breaking between SDK versions. We'll see what we can find.
This issue is caused by https://github.com/dotnet/wpf/pull/6534, tracked in https://github.com/dotnet/wpf/issues/6792. See https://github.com/dotnet/wpf/issues/6792#issuecomment-1183471065 for the resolution.
Current behavior
Uno.UI.SourceGenerators generates duplicate values (for example Duplicate 'System.Runtime.CompilerServices.CompilerGeneratedAttribute)
Expected behavior
Does not duplicate values and works.
How to reproduce it (as minimally and precisely as possible)
Make Uno Default Project
1) dotnet new uno unoapp-uwp-net6 Mapsui.Samples.Uno 2) add global.json does not work
3) Open with Visual Studio 2022 Preview Mapsui.Samples.Uno.sln 4) Build Mapsui.Samples.Uno.Skia.Wpf
Workaround
Workaround is to add following global.json
or set a sdk version not 6.0.302
Works on UWP/WinUI
Yes
Environment
Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
NuGet package version(s)
4.4.13
Affected platforms
Skia (WPF)
IDE
Visual Studio 2022
IDE version
17.3 (Preview)
Relevant plugins
Resharper Version 2022.2
Anything else we need to know?
I looked at this, but didn't find something yet.
https://platform.uno/docs/articles/uno-development/troubleshooting-source-generation.html
This project uses nuget Central Package Management. Scripts\DisableCentralPackageManagement.ps1 can be used to disable CentralPackageManage-ment (The error still occours).
It seems that all Generated Code is generated more than 1 Time causing this duplicate messages. But I checked annd the Shared Project is only referenced once. I also removed the shared project and added it again still no success.
Sample Error Messages
Enabeling
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
Produces valid c# Files