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

Error getting generic grain when using a prefix #9355

Open
jsteinich opened this issue Feb 21, 2025 · 0 comments
Open

Error getting generic grain when using a prefix #9355

jsteinich opened this issue Feb 21, 2025 · 0 comments

Comments

@jsteinich
Copy link
Contributor

Given the following types:

interface IGenericGrain<TRequest, TResponse>{}

class ConcreteGrain : IGenericGrain<RequestType, ResponseType>{}

this call will fail to find the grain:

GrainFactory.GetGrain<IGenericGrain<TRequest, TResponse>>(myKey, "ConcreteGrain")

Omitting the prefix does work (if only one type)

GrainFactory.GetGrain<IGenericGrain<TRequest, TResponse>>(myKey)

In 7.1.2 the first call worked successfully, but in 8.2 it no longer works. (I haven't tried any version in-between)

I debugged a bit and

public GrainType GetGrainType(GrainInterfaceType interfaceType, string prefix)
has a pretty different flow (in regards to a cache lookup failure) between the two calls.
The cache seems to only have an entry for IGenericGrain<RequestType, ResponseType> and not for IGenericGrain<TRequest, TResponse>; however, the result of
lookupType = genericInterface.GetGenericGrainType().Value;
is the generic type which causes the cache lookup to fail.

Perhaps the lookup failing is fine and it should have something similar to the other flow, but I'm not familiar enough to say:

else if (GenericGrainInterfaceType.TryParse(interfaceType, out var genericInterface) && genericInterface.IsConstructed)

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

1 participant