Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random crashes #45

Open
skarllot opened this issue Apr 13, 2024 · 3 comments
Open

Random crashes #45

skarllot opened this issue Apr 13, 2024 · 3 comments

Comments

@skarllot
Copy link
Contributor

The generator is randomly crashing with the error below:

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 '<redacted>.IFileDiscovery.cs' of the added source file must be unique within a generator. (Parameter 'hintName')'.
System.ArgumentException: The hintName '<redacted>.IFileDiscovery.cs' of the added source file must be unique within a generator. (Parameter 'hintName')
at Microsoft.CodeAnalysis.AdditionalSourcesCollection.Add(String hintName, SourceText source) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Compilers\Core\Portable\SourceGeneration\AdditionalSourcesCollection.cs:line 78
at AutomaticInterface.AutomaticInterfaceGenerator.GenerateCode(SourceProductionContext context, ImmutableArray`1 enumerations)
at Microsoft.CodeAnalysis.UserFunctionExtensions.c__DisplayClass3_0`2. b__0(TInput1 input1, TInput2 input2, CancellationToken token) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Compilers\Core\Portable\SourceGeneration\UserFunction.cs:line 101

-----

System.ArgumentException: The hintName '<redacted>.IFileDiscovery.cs' of the added source file must be unique within a generator. (Parameter 'hintName')
at Microsoft.CodeAnalysis.AdditionalSourcesCollection.Add(String hintName, SourceText source) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Compilers\Core\Portable\SourceGeneration\AdditionalSourcesCollection.cs:line 78
at AutomaticInterface.AutomaticInterfaceGenerator.GenerateCode(SourceProductionContext context, ImmutableArray`1 enumerations)
at Microsoft.CodeAnalysis.UserFunctionExtensions.c__DisplayClass3_0`2. b__0(TInput1 input1, TInput2 input2, CancellationToken token) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Compilers\Core\Portable\SourceGeneration\UserFunction.cs:line 101
@ChristianSauer
Copy link
Collaborator

I've encountered this Problem before. The problem is that the created name must be unique, but the API of an interface Generator does not allow to check for that.
To solve this: Can you make sure that only one interface with the name FileDiscovery exists?

@skarllot
Copy link
Contributor Author

Yes, there's only one

@ChristianSauer
Copy link
Collaborator

ChristianSauer commented Apr 15, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants