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

Source Generator Unique Hint Name Error #45

Closed
StevenTCramer opened this issue Apr 15, 2024 · 0 comments · Fixed by #46
Closed

Source Generator Unique Hint Name Error #45

StevenTCramer opened this issue Apr 15, 2024 · 0 comments · Fixed by #46

Comments

@StevenTCramer
Copy link
Contributor

When using a mixin on a nested class with the same name inside different parent classes. I think Moxy generates the same "hint name" and thus get this error.

CSC : error CS8785: Generator 'RoslynIncrementalGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'ArgumentExceptio
n' with message 'The hintName 'TimeWarp.Architecture.Features.TodoItems.Command.RouteMixin.Instance1.MixinCode.Moxy.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')'. [
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\Analytics\TrackEvent.cs(3,2): erro
r CS0246: The type or namespace name 'TrackEventValidiationAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architecture\
Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\Analytics\TrackEvent.cs(3,2): erro
r CS0246: The type or namespace name 'TrackEventValidiation' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\Ti
meWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\Commands\RouteMixinNeste
dTestClass.cs(5,4): error CS0246: The type or namespace name 'RouteMixinAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-
architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\Commands\RouteMixinNeste
dTestClass.cs(5,4): error CS0246: The type or namespace name 'RouteMixin' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architect
ure\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\Commands\UpdateTodoItem.
cs(5,4): error CS0246: The type or namespace name 'RouteMixinAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architectur
e\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\Commands\UpdateTodoItem.
cs(5,4): error CS0246: The type or namespace name 'RouteMixin' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\
TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\Commands\CreateTodoItem.
cs(5,4): error CS0246: The type or namespace name 'RouteMixinAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architectur
e\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\Commands\CreateTodoItem.
cs(5,4): error CS0246: The type or namespace name 'RouteMixin' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\
TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\Commands\CreateTodoItem.
cs(6,90): error CS0535: 'CreateTodoItem.Command' does not implement interface member 'IApiRequest.GetRoute()' [D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\tem
plates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\Commands\CreateTodoItem.
cs(6,90): error CS0535: 'CreateTodoItem.Command' does not implement interface member 'IApiRequest.GetHttpVerb()' [D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\
templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\TodoItemDto.cs(3,2): err
or CS0246: The type or namespace name 'CreateCommandAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\
TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\TodoItemDto.cs(3,2): err
or CS0246: The type or namespace name 'CreateCommand' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.
Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
D:\git\github\TimeWarpEngineering\timewarp-architecture\Source\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Features\TodoItems\TodoItemDto.cs(3,17): er
ror CS0246: The type or namespace name 'UpdateCommandAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\git\github\TimeWarpEngineering\timewarp-architecture\Source
\TimeWarp.Architecture.Template\templates\TimeWarp.Architecture\Source\ContainerApps\Web\Web.Contracts\Web.Contracts.csproj]
mrpmorris pushed a commit that referenced this issue Apr 15, 2024
…) #45

* Add DeclaringTypeto the FileName to avoid duplicates.

* Put namespace in filename so we don't get clash.
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

Successfully merging a pull request may close this issue.

1 participant