Skip to content

Cannot resolve type only in Release build config #29705

@maslewandowski

Description

@maslewandowski

Description

Hi,

When building an iOS release configuration, XAML compilation fails with the following errors:

XamlC error XC0000: Cannot resolve type "http://schemas.microsoft.com/dotnet/2022/maui/toolkit:MediaElement".
XamlC error XC0000: Cannot resolve type "http://schemas.devexpress.com/maui:ChartView".

These errors occur even though the corresponding NuGet packages are referenced:

  • CommunityToolkit.Maui.MediaElement
  • DevExpress.Maui.Charts
  • DevExpress.Maui.Core

The issue does not occur in Debug builds — only in Release (with AOT and trimming).

What i tried:

  • <PublishTrimmed>false> in csproj
  • <TrimMode>copyused>, <IsTrimmable>false>, <EnableTrimAnalyzer>false>
  • Adding <TrimmerRootAssembly> entries for all related libraries
  • Ensuring XML namespaces and XAML usage are correct
  • Rebuilding clean Debug/Release, validating assemblies are present
  • called fakemethods in the code behind files of the styles.xaml to actually use the types that i need. (like here)

Steps to Reproduce

  1. Create a new .NET MAUI project targeting iOS.
  2. Create a new .NET MAUI Class Library Project targeting iOS.
  3. Set Reference from class library to executed project (app)
  4. Add CommunityToolkit.Maui.MediaElement and/or DevExpress.Maui.Charts to class library
  5. change reference in main project to class library for styles
  6. Use a control like <toolkit:MediaElement /> or <dx:ChartView /> in a .xaml file.
  7. Build the project in Release mode for net9.0-ios.
  8. Observe the XamlC error XC0000 messages.

alternatively just build styles.xaml in sample repo in release build config.

Please help me i want to distribute my app asap.

If you tell me that encapsulation of resources like styles does not work, then tell me please.

Link to public reproduction project repository

https://github.com/maslewandowski/problemwithtrimmingmauiresources

Version with bug

9.0.70 SR7

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

IOS 18.4

Did you find any workaround?

No response

Relevant log output

source\repos\problemwithtrimmingmauiresources\styles\CommunityToolkitStyles.xaml(8,12): XamlC error XC0000: Cannot resolve type "http://schemas.microsoft.com/dotnet/2022/maui/toolkit:MediaElement".
1>Done building project "styles.csproj" -- FAILED.

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform/ioss/needs-infoIssue needs more info from the authort/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions