codecentric / net_automatic_interface

.Net Source Generator for Automatic Interfaces
MIT License
62 stars 14 forks source link

Can not generate interface for two classes in same directory #25

Closed awasilik closed 9 months ago

awasilik commented 9 months ago

Thanks for the update! After latest change to 2.0.0 AutomaticInterface can not generate interface for two classes in the same directory with same namespace. Generation produced error:

CSC: Warning CS8785 : Generator 'AutomaticInterfaceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentException' with message 'The hintName 'ProjectName.cs' of the added source file must be unique within a generator. (Parameter 'hintName')'.

ChristianSauer commented 9 months ago

I noticed this just this minute, too. I think 2.1.0 should fix this issue. Rather annoying limitation of the incremental generators, see https://github.com/dotnet/roslyn/discussions/60272 It should be fixed for most cases but could still cause problems if there are two files with the same name in the namespace.

ChristianSauer commented 9 months ago

Is this still an issue?