You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using file-local types as generic type parameters in Source Generator implementation, Roslyn fails to properly validate the usage and results in runtime path exception, despite the code being syntactically valid.
Code compiles successfully despite potential invalidity of file-local type usage
At runtime, source generator fails with:
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at Microsoft.CodeAnalysis.GeneratorDriver.ParseAdditionalSources(...)
Expected Behavior
Roslyn should either:
Properly validate and reject invalid file-local type usage in generic constraints at compile time
Or handle file-local types correctly without throwing path exceptions
Environment
Latest Roslyn/MSBuild toolchain
Reproducible in both Visual Studio and Rider
Source Generator compilation context
The text was updated successfully, but these errors were encountered:
KARPED1EM
changed the title
[Bug] Inconsistent handling of file-local types as generic types in source generator causes invalid path exception at compile time
Inconsistent handling of file-local types in generic constraints causes path exception in Source Generator
Feb 13, 2025
Issue Description
When using file-local types as generic type parameters in Source Generator implementation, Roslyn fails to properly validate the usage and results in runtime path exception, despite the code being syntactically valid.
Reproduction Code
Basic structure showing the issue:
Current Behavior
Expected Behavior
Roslyn should either:
Environment
The text was updated successfully, but these errors were encountered: