-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
WinUI3 app compiled as AOT publishes managed pdb instead of native #108087
Comments
We should also verify whether this is an actual issue with WinUI 3, or whether it affects UWP .NET 9 as well. Or in general, any packaged MSIX app using Native AOT. We're working on extracting all that tooling out of WinAppSDK and into a standalone single-project MSIX package (that both WinUI 3 and UWP .NET 9 will take a dependency on), so if the issue is caused by something in the MSIX tooling, there's a chance this will affect anyone using that with Native AOT, not just WinUI 3 apps. I can help put together a UWP .NET 9 repro mirroring the one Jevan shared and report back 🙂 |
I'm having trouble with the repro - first complaint indicated I need to run restore, so I added
Before I spend more time trying to get a repro, can you try with .NET 9? I believe this was fixed in .NET 9 (#98342). |
For the repro, my pubxml files didn't push because of the default .gitignore. I just fixed that. For building, I did:
I also retargeted to .net9 (just change line 6 in the csproj from net8 to net9) and it still repro'd. WinAppSDK's target __GetPublishItems is ultimately calling VS's DebugSymbolsProjectOutputGroup which just does:
The PR you linked fixes it so that ComputeResolvedFilesToPublishList doesn't have any PDBs in it, but the MSIX packaging targets are still looking to collect pdbs (in target GetPackagingOutputs) and they get those by calling DebugSymbolsProjectOutputGroup. The same modification made in that PR should be done to _DebugSymbolsProjectOutputGroupOutput, but after removing the pdb from _DebugSymbolsProjectOutputGroupOutput, we need to add back the AOT pdb so that the packaged symbols are correct. |
Hmm, but Digging into this more, I tried an experiment:
The PDB in the package is the correct one (matches the size of the one under obj\x64\Release\net8.0-windows10.0.22621.0\win-x64\linked\ instead of the one under obj\x64\Release\net8.0-windows10.0.22621.0\win-x64). But looking at For whatever reason, this logic is explicitly excluded for PublishAot and only kicks in for PublishTrimmed and PublishReadyToRun. I think we need someone from WinAppSdk to explain the expected behavior. |
So yes, WinAppSDK is defining the target that collects the PDBs. But it's mostly just a copy of the old AppxPackage targets. They're calling the target DebugSymbolsProjectOutputGroup which is defined in
Returns DebugSymbolsProjectOutputGroupOutput, which comes from:
And _DebugSymbolsIntermediatePath comes also from that same file:
Are you suggesting that MSIX packaging should be getting the pdbs from a different Target/item group? |
The paths from there are wrong for publish: for example, when doing a publish with PublishAot we're interested in native symbols; for PublishTrimmed we're interested in symbols for the trimmed assembly, not the untrimmed thing that build produced. Microsoft.Build.Msix.Packaging.targets has extra code to compensate for this in PublishTrimmed - MSIX packaging works correctly in a PublishTrimmed app (the |
I think I can confirm the issue is also affecting UWP on .NET 9 (as expected, since we use the same exact MSIX tooling as WinAppSDK anyway). Publishing a package for a test app, I see what I assume is the correct .pdb in the @Scottj1s FYI if the fix is in the MSIX tooling, this is one more good reason to split that out of WinAppSDK. Once we do that and fix this, then both UWP on .NET 9 and WinAppSDK will work correctly here. And if WinAppSDK had just a package reference on the MSIX tooling, then anyone would be able to get the fix at any time without being tied to any WinAppSDK version 😄 |
I'm closing this as this doesn't seem to be actionable in this repo. We can reopen if/when we find out some fix is needed here and know what the fix should be. |
@MichalStrehovsky what is the "correct" way to pick up the accumulated .pdbs for packaging that would handle regular case, Trimming, ReadyToRun, and AOT? Is there a different target and Item Group that the MSIX targets should be using? |
There is actually a difference here between ILLink and LinkNative. For ILLink, the pdb generated by the linker is included in _LinkedResolvedFileToPublishCandidate here
For LinkNative, the pdb generated for the native exe doesn't seem to be included in ResolvedFileToPublish. It is only removing the pdb produced by the build from the item group here runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets Line 27 in 4f60693
@MichalStrehovsky it probably would be good to make sure the native pdb gets added to the ResolvedFileToPublish item group, similar to what ILLink does? |
This difference is a leftover from many years ago. We'd like to make it work same as ILLink. Tracked at dotnet/sdk#40488.
There isn't one that I know of, but I didn't know about the ways MSIX target does it for R2R/Trimming either so it doesn't say much. I don't know how much MSIX packaging just relies on implementation details of R2R/Trimming right now and how much of it is standard. The fact that MSIX packaging needs to special case PublishTrimmed and PublishReadyToRun makes it feel more like "it's relying on implementation details" than "we have a standardized way to know what symbol files are part of publish". |
Description
When generating app packages for a WinUI3 app, the msix contains the AOT'd exe but the symbol package contains the managed pdb instead of the native pdb.
Reproduction Steps
Expected behavior
msixsym file should contain the native PDB
Actual behavior
Result: bin\x64\Release\net8.0-windows10.0.22621.0\win-x64\AppPackages\WinUI3SingleProjMSIX_1.0.4.0_x64_Test\WinUI3SingleProjMSIX_1.0.4.0_x64.msixsym contains only the managed pdb, not the native pdb.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
ComputeLinkedFilesToPublish target fixes this up for the native binary, but the pdb is left untouched. I recommend updating this target to rewrite the _DebugSymbolsIntermediatePath and DebugSymbolsProjectOutputGroupOutput to do the same so that GetPackagingOutputs sees native pdb.
The text was updated successfully, but these errors were encountered: