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

Generating grains in project contaning "Cluster" namespace breaks sourcegen #1840

Closed
jupjohn opened this issue Oct 27, 2022 · 1 comment · Fixed by #1849
Closed

Generating grains in project contaning "Cluster" namespace breaks sourcegen #1840

jupjohn opened this issue Oct 27, 2022 · 1 comment · Fixed by #1849

Comments

@jupjohn
Copy link
Contributor

jupjohn commented Oct 27, 2022

When generating grains in a project whose root namespace contains *.Cluster.* (e.g. Jammehcow.SomeCoolApplication.Cluster.Contracts.csproj), source generation generates uncompilable code. Since generated code contains references to the Cluster type, the type conflicts with the implementing project's namespace.

Proto.Actor version: 1.0.0-rc4.6

@jupjohn
Copy link
Contributor Author

jupjohn commented Oct 27, 2022

I've seen this approach in other projects: prefixing your types with global::Your.Fully.Qualified.Namespace.Class will fix the conflict.

namespace Jammehcow.SomeCoolApplication.Cluster.Contracts
{
    public abstract class MyGrainBase
    {
        // This would fail to compile
        private readonly Cluster _cluster;

        // This resolves correctly
        private readonly global::Proto.Cluster.Cluster _cluster;
    }
}

If this looks like a decent way to resolve this I'm happy to fix and test myself, then PR it in.

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