[XSG] Enable MauiXamlLineInfo by default for better error reporting
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
## Summary
When XAML source generation produces code with errors (type mismatches, invalid syntax, etc.), the C# compiler error currently points to the generated `.xsg.cs` file. This is confusing for developers who need to trace errors back to the original XAML.
The `#line` directive infrastructure already exists and works - it's just disabled by default due to Roslyn issues with large PDBs.
## Current Behavior
`EnableLineInfo` defaults to `false` in `ProjectItem.cs`:
```csharp
return false; //default to False due to roslyn issues with large pdbs https://github.com/dotnet/maui/issues/37782
```
## Desired Behavior
Enable `MauiXamlLineInfo` by default so compiler errors point to the XAML file/line, not the generated code.
## Blocking Issue
- https://github.com/dotnet/maui/issues/37782 - Roslyn issue with large PDBs
## Next Steps
1. Monitor the Roslyn issue for resolution
2. Once resolved, enable `MauiXamlLineInfo` by default (at least in Debug configuration)
3. Consider enabling it unconditionally if PDB size is acceptable
## Workaround
Users can manually enable it today by adding to their project file:
```xml
true
```
Contributor guide
Assessment
This issue has not been assessed yet.