Skip to content

Fix: MonoRuntimeMixedModeExcludedAssembly ignored when WasmShellAOTProfileExcludedMethods unset#1027

Merged
jeromelaban merged 12 commits intomainfrom
copilot/fix-aot-profile-filtering
Jan 29, 2026
Merged

Fix: MonoRuntimeMixedModeExcludedAssembly ignored when WasmShellAOTProfileExcludedMethods unset#1027
jeromelaban merged 12 commits intomainfrom
copilot/fix-aot-profile-filtering

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

  • Understand the issue - MonoRuntimeMixedModeExcludedAssembly not working when used alone
  • Identify root cause - incorrect parameter type in targets file (property vs item group)
  • Fix the targets file to pass @(MonoRuntimeMixedModeExcludedAssembly) instead of $(WasmShellMixedModeExcludedAssembly)
  • Create a test project that validates the fix using WasmShellGenerateAOTProfileDebugList
  • Document the test with a README
  • Run code review - passed with no comments
  • Security checks - no security concerns (minimal change to MSBuild parameter passing)
  • Add test to CI configuration with explicit publish steps
  • Enhance validation to analyze profile content and verify assembly filtering works correctly
  • Fix solution file configuration (add test to main .sln file)
  • Fix validation target timing and remove from solution filter to avoid memory issues
  • Fix test to actually use Newtonsoft.Json so methods are in the profile
Original prompt

This section details on the original issue you should resolve

<issue_title>[AOT] MonoRuntimeMixedModeExcludedAssembly is not taken into account if WasmShellAOTProfileExcludedMethods is not specified</issue_title>
<issue_description>### Current behavior 🐛

MonoRuntimeMixedModeExcludedAssembly should be useable independently to filter the AOT profile.

Expected behavior 🎯

Profile filtering is properly enabled.

How to reproduce it (as minimally and precisely as possible) 🔬

No response

Workaround 🛠️

No response

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

No response

Uno.Sdk version (and other relevant versions) 📦

10.0.15

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

No response</issue_description>

<agent_instructions>Make sure to add a new test that will validate this behavior using the WasmShellGenerateAOTProfileDebugList file generation, as a post build step.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

The issue was that MixedModeExcludedAssembly parameter was being passed
as a property (string) instead of an item group (array). This prevented
MonoRuntimeMixedModeExcludedAssembly from working independently.

Also added a test project to validate the fix using WasmShellGenerateAOTProfileDebugList.

Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
@CLAassistant
Copy link

CLAassistant commented Jan 26, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ jeromelaban
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 2 commits January 26, 2026 13:08
Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix AOT profile filtering for MonoRuntimeMixedModeExcludedAssembly Fix: MonoRuntimeMixedModeExcludedAssembly ignored when WasmShellAOTProfileExcludedMethods unset Jan 26, 2026
Copilot AI requested a review from jeromelaban January 26, 2026 13:14
@jeromelaban
Copy link
Member

@copilot The new test is not taken into account in CI, let's fix that.

Added Uno.Wasm.Tests.MixedModeProfile to the netcore-only solution filter
to ensure it's built and validated as part of continuous integration.

Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot The new test is not taken into account in CI, let's fix that.

Added the test project to the netcore-only solution filter in commit 05a73a5. The test will now be built as part of the CI pipeline.

@jeromelaban
Copy link
Member

@copilot The test is still not run in the right environment. You must add it to the ci pipeline explicitly with the dotnet publish command, otherwise, the AOT process will not be used.

Added dedicated build steps to both Linux and Windows CI pipelines that
explicitly run 'dotnet publish' on the MixedModeProfile test project.
This ensures the AOT process runs and the post-build validation target
can verify that profile filtering works correctly.

Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot The test is still not run in the right environment. You must add it to the ci pipeline explicitly with the dotnet publish command, otherwise, the AOT process will not be used.

Added explicit dotnet publish steps for the MixedModeProfile test to both Linux and Windows CI pipelines in commit 2d292c6. The test will now be published with AOT enabled, triggering the post-build validation that checks for the profile dump files.

@jeromelaban jeromelaban marked this pull request as ready for review January 26, 2026 13:31
@jeromelaban
Copy link
Member

@copilot The profile should be analyzed to determine if a specific method can be found in it or not (filtering should remove a specific full assembly. Don't update nuget.exe as well.

- Enhanced post-build validation to actually analyze profile content
- Verifies Newtonsoft.Json methods exist in original profile
- Verifies Newtonsoft.Json and System.Xml methods are excluded from filtered profile
- Removed accidentally added nuget.exe binary
- Updated README with detailed validation information

Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1027.eastus2.1.azurestaticapps.net

Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot The profile should be analyzed to determine if a specific method can be found in it or not (filtering should remove a specific full assembly. Don't update nuget.exe as well.

Enhanced the profile validation in commit 363111b. The test now:

  • Reads and analyzes both profile dump files
  • Verifies Newtonsoft.Json methods exist in the original profile
  • Verifies Newtonsoft.Json and System.Xml methods are NOT in the filtered profile
  • Provides detailed error messages showing method counts

Also removed the accidentally added nuget.exe binary.

@jeromelaban
Copy link
Member

@copilot The build fails with:

/__w/1/s/src/Uno.Wasm.Tests.MixedModeProfile/Uno.Wasm.Tests.MixedModeProfile.csproj : Solution file error MSB5028: Solution filter file at "/__w/1/s/src/Uno.Wasm.Bootstrap-netcore-only.slnf" includes project "Uno.Wasm.Tests.MixedModeProfile/Uno.Wasm.Tests.MixedModeProfile.csproj" that is not in the solution file at "/__w/1/s/src/Uno.Wasm.Bootstrap.sln".

The test project was added to the solution filter but not to the main
.sln file, causing MSB5028 build error. Added the project entry with
proper configuration mappings and nested it under the Tests folder.

Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot The build fails with:

Fixed in commit 70776c0. The test project was added to the solution filter (.slnf) but not to the main solution file (.sln). Added the project entry with proper Debug/Release configuration mappings and nested it under the Tests solution folder.

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1027.eastus2.1.azurestaticapps.net

@jeromelaban
Copy link
Member

@copilot The build is failing with on windows:

D:\a\1\s\src\Uno.Wasm.Tests.MixedModeProfile\Uno.Wasm.Tests.MixedModeProfile.csproj(56,3): error : AOTProfileDump.Original.txt was not generated. MonoRuntimeMixedModeExcludedAssembly may not be working correctly.

Also, it seems that adding the csproj to the netcore-only filter causes memory issues on the build agent. Let's remove it from the slnf, and we'll let the single test run on its own.

- Removed MixedModeProfile from netcore-only.slnf to avoid memory issues
- Changed validation target to run AfterTargets="Publish" instead of "Build"
- Added condition to only run validation when WasmAotProfilePath is set
- AOT profile processing happens during Publish, not Build phase

Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot The build is failing with on windows:

Fixed in commit ddecc5f:

  • Removed the test from netcore-only.slnf to avoid memory issues
  • Changed validation target to run after "Publish" instead of "Build" (AOT profile processing happens during publish phase)
  • Added condition to only run validation when WasmAotProfilePath is set

The test now runs standalone via the explicit dotnet publish steps in the CI pipeline.

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1027.eastus2.1.azurestaticapps.net

@jeromelaban
Copy link
Member

@copilot The new test is failing in:

/__w/1/s/src/Uno.Wasm.Tests.MixedModeProfile/Uno.Wasm.Tests.MixedModeProfile.csproj(76,3): error : No Newtonsoft.Json methods found in original profile. The test may not be using the assembly correctly.

…tion

- Updated Program.cs to actually use Newtonsoft.Json (SerializeObject/DeserializeObject)
- Changed from WasmShellEnableAotProfile to WasmAotProfilePath property
- This ensures Newtonsoft.Json methods are in the AOT profile so validation can verify they're filtered out

Co-authored-by: jeromelaban <5839577+jeromelaban@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

@copilot The new test is failing in:

Fixed in commit 2160d63:

  • Updated Program.cs to actually use Newtonsoft.Json (SerializeObject and DeserializeObject calls)
  • Changed profile configuration from WasmShellEnableAotProfile item to WasmAotProfilePath property

The test now uses Newtonsoft.Json in the code, ensuring its methods are included in the AOT profile so the validation can verify they're properly filtered out by MonoRuntimeMixedModeExcludedAssembly.

@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1027.eastus2.1.azurestaticapps.net

1 similar comment
@github-actions
Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-river-0087b630f-1027.eastus2.1.azurestaticapps.net

@jeromelaban jeromelaban enabled auto-merge January 27, 2026 18:24
@jeromelaban jeromelaban merged commit 7ba215b into main Jan 29, 2026
10 of 11 checks passed
@jeromelaban jeromelaban deleted the copilot/fix-aot-profile-filtering branch January 29, 2026 12:32
@jeromelaban
Copy link
Member

@Mergifyio backport release/stable/10.0

@mergify
Copy link

mergify bot commented Jan 29, 2026

backport release/stable/10.0

✅ Backports have been created

Details

jeromelaban added a commit that referenced this pull request Jan 29, 2026
…0.0/pr-1027

Fix: MonoRuntimeMixedModeExcludedAssembly ignored when WasmShellAOTProfileExcludedMethods unset (backport #1027)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AOT] MonoRuntimeMixedModeExcludedAssembly is not taken into account if WasmShellAOTProfileExcludedMethods is not specified

4 participants