Source Generators crash/fail with duplicate types #14158
Labels
area-tooling
XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging
area-xaml
XAML, CSS, Triggers, Behaviors
fixed-in-8.0.0-preview.4.8333
Look for this fix in 8.0.0-preview.4.8333!
platform/android 🤖
platform/iOS 🍎
platform/macOS 🍏
macOS / Mac Catalyst
platform/windows 🪟
t/bug
Something isn't working
Milestone
Description
If you define the
XmlnsDefinitionAttribute
in any library/app, then the source generators just stop resolving types:This is notable as it does not distinguish between public/internal/private. The
Compilation.GetTypeByMetadataName()
method returns null if zero or more than one type exists. So, when we define a type internally for any reason (in my case I am merging all the dlls for the build tasks) the source generators just stop:And this issue also appears when you define multiple types and expose them with this attribute. If the app does this:
And there are 2projects:
My Maui App:
Third Party Library:
Steps to Reproduce
See the description...
Link to public reproduction project repository
I have a PR in the works with unit tests
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, Windows, macOS, Other (Tizen, Linux, etc. not supported by Microsoft directly)
Affected platform versions
All things - this is the compiler
Did you find any workaround?
Not really. I do not control one of the assemblies.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: