MACOS Rider errors with maui

Title: Rider fails to resolve MAUI XAML generated code (InitializeComponent and __XamlGeneratedCode errors), while project builds successfully via dotnet

Environment:
- Rider version: 2026.1.1
- OS: macOS 26.4.1
- .NET SDK: 10.0.203
- MAUI workload: maui                                              10.0.20/10.0.100      SDK 10.0.200  
- Project type: .NET MAUI

---

Description:

Rider reports multiple errors related to XAML code generation in a .NET MAUI project, including:

- No defining declaration found for implementing declaration of partial method 'void InitializeComponent()'
- Cannot resolve symbol 'InitializeComponentRuntime'
- The type '__XamlGeneratedCode__.__TypeXXXX' must be convertible to 'Microsoft.Maui.Controls.ResourceDictionary'

However, the project:
- builds successfully using dotnet build
- runs correctly
- shows no such errors in other environments (e.g. VS Code)

This suggests Rider's design-time build or XAML code generation/indexing is out of sync with actual MSBuild behavior.

---

Steps to Reproduce:

1. Create or open a .NET MAUI project
2. Add one or more XAML files (e.g. ResourceDictionaries)
3. Reference them via:
  xml    <ResourceDictionary Source="SomeFile.xaml" />    
4. Open the project in Rider
5. Observe errors in editor

---

Expected Behavior:

- Rider correctly recognizes generated .g.cs files
- No false-positive errors for InitializeComponent
- XAML resources are resolved consistently with dotnet build

---

Actual Behavior:

- Rider shows unresolved InitializeComponent and related symbols
- Reports type conversion errors for generated __XamlGeneratedCode types
- Errors persist even after:
 - rebuilding solution
 - clearing bin/obj
 - invalidating caches

---

Additional Notes:

- The issue seems related to Rider not properly handling MAUI XAML code generation
- Possibly tied to design-time build or MSBuild integration
- Opening and building the same project in Visual Studio may “fix” generation temporarily

---

Workarounds Tried:

- File → Invalidate Caches / Restart
- Deleting bin/ and obj/
- Forcing rebuild
- Verifying Build Action = MauiXaml
- Ensuring correct x:Class usage

---

0
3 comments

Hello! 

We've tried to reproduce the issue you described, but with no success. According to your steps to reproduce, you can recreate the issue with a new sample solution. If so, could you please share it? Upload the file to our server and share the ID.

Thanks! 

 

0

I had the same issue when creating a basic .Net 10 MAUI app via Rider. It looks like the issue is related to SourceGen being enabled, BUT triggered by a mismatch between the SDK and the workload. To resolve this, I just ran `dotnet workload update` and the issue was gone which might explain why Alexandra Guk could not reproduce it. Hope it helps!

0

Actually, I take it back. It doesn't work. The only thing I can do to resolve the issue is disable SourceGen by commenting out or removing this line from the project <MauiXamlInflator>SourceGen</MauiXamlInflator>

0

Please sign in to leave a comment.