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

Cryptic TypeLoadException if actor proxy interface is non-public #859

Open
cgillum opened this issue Apr 9, 2022 · 1 comment · May be fixed by #1148
Open

Cryptic TypeLoadException if actor proxy interface is non-public #859

cgillum opened this issue Apr 9, 2022 · 1 comment · May be fixed by #1148
Labels
kind/bug Something isn't working

Comments

@cgillum
Copy link
Contributor

cgillum commented Apr 9, 2022

Consider the following code snippet:

    ActorId actorId = new("123");
    IMyActor proxy = ActorProxy.Create<IMyActor>(actorId, nameof(MyActor));

    // The Init method invokes the actor directly, which then decides whether to apply de-dupe logic.
    await proxy.MyMethod();

Also, assume IMyActor is an internal interface (non-public).

Expected Behavior

Internal interfaces should be supported, OR there should be a friendly exception explaining why my interface is invalid.

Actual Behavior

If IMyActor is internal, I get the following cryptic exception:

System.TypeLoadException: Type 'MyNamespace.IMyActor_.actorV1.proxyIMyActoractorV1Proxy' from assembly 'MyNamespace.IMyActor_.actorV1.proxy, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.

It's not at all clear what needs to be done to fix this issue.

@cgillum cgillum added the kind/bug Something isn't working label Apr 9, 2022
@halspang
Copy link
Contributor

Pretty sure this is happening in here: https://github.com/dapr/dotnet-sdk/blob/master/src/Dapr.Actors/Builder/ActorCodeBuilder.cs

I think providing a better exception is probably the right path here. Maybe my understanding of the scoping is incorrect but I don't think we could index into an internal class that doesn't exist within our own assembly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants