Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet-sdk-9.0.100-rc.2.24474.11] paint.netcore build with error "Missing partial modifier on declaration of type 'AffineTransform2DEffect3'; another partial declaration of this type exists" #43746

Closed
Junjun-zhao opened this issue Sep 27, 2024 · 14 comments
Labels
Area-NetSDK Area-WindowsSDK Issues related to the Windows SDK and how it is included and managed in the .NET SDK untriaged Request triage from a team member

Comments

@Junjun-zhao
Copy link
Member

Junjun-zhao commented Sep 27, 2024

Application Name: paint.netcore
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-rc.2.24474.11
App & Source Location checking at:https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2264288

Verify Scenarios:
1). Windows 10 21H2 AMD64 + Default .NET 8 + 9.0.100-rc.1.24452.12 + WindowsSdkPackageVersion 10.0.26100.42: Pass
2). Windows 10 21H2 AMD64 + Default .NET 8 + 9.0.100-rc.1.24452.12 + WindowsSdkPackageVersion 10.0.26100.45: Pass
3). Windows 10 21H2 AMD64 + Default .NET 8 + 9.0.100-rc.2.24474.11 + WindowsSdkPackageVersion 10.0.26100.42: Fail
4). Windows 10 21H2 AMD64 + Default .NET 8 + 9.0.100-rc.2.24474.11 + WindowsSdkPackageVersion 10.0.26100.45: Fail

Description :
When verifying the bug [dotnet-sdk-9.0.100-rc.2.24474.11] paint.netcore build with errors about elements from Microsoft.Windows.SDK.NET are not found · Issue #43707 · dotnet/sdk (github.com), after update the WindowsSdkPackageVersion to 10.0.26100.45 as mentioned in this comment, the errors in that bug are all gone.
But we get a new build error:

CS0260 Missing partial modifier on declaration of type 'AffineTransform2DEffect3'; another partial declaration of this type exists Windows.Framework

App Repro Steps: (You can try it on the repro machine provided in devdiv bug)

The machine has dotnet-sdk-9.0.100-rc.2.24474.11 installed and add its internal feed to Nuget.config file. And the Visual Studio has native libraries like ATL, MFC installed.
1.Copy \SourceShare\paint.net to local machine
2. Open command prompt window and navigate to ...\paint.net folder.
3. Run "dotnet new globaljson" to create a global json file and make sure the dotnet-sdk-9.0.100-rc.2.24474.11 assigned:

{
  "sdk": {
    "version": "9.0.100-rc.2.24474.11"
  }
}
  1. Open "...\paint.net\TargetFramework.props" file to update the <WindowsSdkPackageVersion> to 10.0.26100.45:
    <WindowsSdkPackageVersion>10.0.26100.45</WindowsSdkPackageVersion>
  2. Open ...\paint.net\paintdotnet.sln with Visual Studio.
  3. Build the "AppVersion" project (Solution Explorer -> Solution -> Misc (it's the first item) -> AppVersion).
  4. Set the Solution Configuration to "Release"
  5. Build -> Rebuild All

Expected Result:
Build successfully except 2 arm64 related errors that we will ignore them.
image

Actual Result: (Please get the binlog and compiler log from attachment of devdiv bug), because the size is larger than 25M and can't be uploaded here)
Build failed with errors:

CS0260 Missing partial modifier on declaration of type 'AffineTransform2DEffect3'; another partial declaration of this type exists
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Windows.Framework\obj\Release\ref\PaintDotNet.Windows.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\UI\obj\Release\ref\PaintDotNet.UI.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\UI\obj\Release\ref\PaintDotNet.UI.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\UI\obj\Release\ref\PaintDotNet.UI.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\UI\obj\Release\ref\PaintDotNet.UI.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\UI\obj\Release\ref\PaintDotNet.UI.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\UI\obj\Release\ref\PaintDotNet.UI.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\SystemLayer\obj\Release\ref\PaintDotNet.SystemLayer.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Resources\obj\Release\ref\PaintDotNet.Resources.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Resources\obj\Release\ref\PaintDotNet.Resources.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Resources\obj\Release\ref\PaintDotNet.Resources.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Resources\obj\Release\ref\PaintDotNet.Resources.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Resources\obj\Release\ref\PaintDotNet.Resources.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Resources\obj\Release\ref\PaintDotNet.Resources.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Framework\obj\Release\ref\PaintDotNet.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Framework\obj\Release\ref\PaintDotNet.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Framework\obj\Release\ref\PaintDotNet.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Framework\obj\Release\ref\PaintDotNet.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Framework\obj\Release\ref\PaintDotNet.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Framework\obj\Release\ref\PaintDotNet.Framework.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects\obj\Release\ref\PaintDotNet.Effects.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects\obj\Release\ref\PaintDotNet.Effects.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects.Legacy\obj\Release\ref\PaintDotNet.Effects.Legacy.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects.Legacy\obj\Release\ref\PaintDotNet.Effects.Legacy.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects.Gpu\obj\Release\ref\PaintDotNet.Effects.Gpu.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects.Core\obj\Release\ref\PaintDotNet.Effects.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects.Core\obj\Release\ref\PaintDotNet.Effects.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects.Core\obj\Release\ref\PaintDotNet.Effects.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Effects.Core\obj\Release\ref\PaintDotNet.Effects.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Data\obj\Release\ref\PaintDotNet.Data.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Data\obj\Release\ref\PaintDotNet.Data.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Data\obj\Release\ref\PaintDotNet.Data.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Data\obj\Release\ref\PaintDotNet.Data.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Data\obj\Release\ref\PaintDotNet.Data.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Core\obj\Release\ref\PaintDotNet.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Core\obj\Release\ref\PaintDotNet.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Core\obj\Release\ref\PaintDotNet.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Core\obj\Release\ref\PaintDotNet.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Core\obj\Release\ref\PaintDotNet.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Core\obj\Release\ref\PaintDotNet.Core.dll' could not be found
CS0006 Metadata file 'C:\Users\Test01\Desktop\paint.net\Core\obj\Release\ref\PaintDotNet.Core.dll' could not be found

Findings:
All the CS0006 error should be caused by CS0260 error which results to the projects build failed. It is also caused by codegen like #43680.

After clicking the definition from Visual Studio, it shows the "sealed class AffineTransform2DEffect3" is conflicting with source generated "partial class AffineTransform2DEffect3"
image

Dotnet Info:

.NET SDK:
 Version:           9.0.100-rc.2.24474.11
 Commit:            315e1305db
 Workload version:  9.0.100-manifests.82e6a096
 MSBuild version:   17.12.0-preview-24473-03+fea15fbd1

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.100-rc.2.24474.11\

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0-rc.2.24473.5
  Architecture: x64
  Commit:       990ebf52fc

.NET SDKs installed:
  10.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
 Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@dotnet-actwx-bot @dotnet/compat

@Junjun-zhao
Copy link
Member Author

@jaredpar Could you please also take a look at this issue and confirm if this is a RC2 blocker? Thanks.

@baronfel
Copy link
Member

cc @Sergio0694 and @manodasanW for triage/analysis on this

@baronfel baronfel added the Area-WindowsSDK Issues related to the Windows SDK and how it is included and managed in the .NET SDK label Sep 27, 2024
@jaredpar
Copy link
Member

This is the 3rd bug we've seen in this rough setup where we're getting unexpected generation for existing apps. This feels like an issue that we need to be dealing with very quickly. @Sergio0694 we need a higher level of engagement here.

@jaredpar
Copy link
Member

Thanks for adding the complog @Junjun-zhao. Used that to verify this is not a C# compiler issue. The generated code in this case is not correct compared to the code it generated against (generated code has a partial type where the source code is not marked as partial). This seems to be an issue with the WinRT source generator. Either it's running where it shouldn't or the generator has a bug.

@manodasanW
Copy link
Contributor

manodasanW commented Sep 27, 2024

Will be addressed by microsoft/CsWinRT#1799

@Junjun-zhao
Copy link
Member Author

Thanks @jaredpar @manodasanW. Could I know what release this fix will be merged into? As we are going to sign off the validation for RC2, is it a blocker for it?

@manodasanW
Copy link
Contributor

There are two workarounds for this issue:

  1. The parent type which is currently not partial can be made partial and the issue won't occur.
  2. The below property can be set inside of a PropertyGroup in your csproj or props file which will disable the source generator causing the issue.

<CsWinRTAotOptimizerEnabled>false</CsWinRTAotOptimizerEnabled>

Once the fix is also available in the Windows SDK projection published to NuGet, someone can also explicitly set WindowsSdkPackageVersion property to explicitly pull in the fix until it is available in the .NET SDK by default.

@manodasanW
Copy link
Contributor

This is also fixed in the updated Windows SDK projection package. Someone can get the fix to try with the repro before it is available in the .NET SDK by updating the WindowsSdkPackageVersion property in ...\paint.net\TargetFramework.props from step 5 to the below.

<WindowsSdkPackageVersion>10.0.26100.48</WindowsSdkPackageVersion>

@Junjun-zhao
Copy link
Member Author

Thanks @manodasanW. We verified the issue with WindowsSdkPackage#10.0.26100.48, it has been fixed. Thank you.

@marcpopMSFT
Copy link
Member

#43889

@Junjun-zhao
Copy link
Member Author

@manodasanW @marcpopMSFT It still reproduces with the latest build dotnet-sdk-9.0.100-rtm.24515.15 when the default WindowsSdkPackageVersion is 10.0.26100.45. Could you please take a look at this issue again?
Note: The error can go away if we set it to 10.0.26100.34 or below.

@marcpopMSFT
Copy link
Member

@manodasanW @marcpopMSFT It still reproduces with the latest build dotnet-sdk-9.0.100-rtm.24515.15 when the default WindowsSdkPackageVersion is 10.0.26100.45. Could you please take a look at this issue again? Note: The error can go away if we set it to 10.0.26100.34 or below.

Can you clarify, are you manually setting the windows sdk package version? The fix Manodasan put in was in the windows sdk package and we updated the defaults in the SDK to version .54. If you're overwriting that default back to the old version then it's expected that this would still repro.

@Junjun-zhao
Copy link
Member Author

Understand. Thanks @marcpopMSFT

This original issue is that failed to build the app when WindowsSdkPackageVersion property was set to .45, so we keep as it-is and reproduced the issue.
As the issue is caused by the generated code in the Windows SDK, in this case, user needs to update the WindowsSdkPackageVersion property to use version >= .48 which contains the fix to make it work.

For the projects which don't not have WindowsSdkPackageVersion property set like Text-Grap project, it will work directly with the latest .NET 9 build# dotnet-sdk-9.0.100-rtm.24515.15 as the defaults in the SDK is version .54 .

@marcpopMSFT
Copy link
Member

Sounds like it's working now if customers get the right package so closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK Area-WindowsSDK Issues related to the Windows SDK and how it is included and managed in the .NET SDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

5 participants