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

Getting a StreamJsonRpc.RemoteInvocationException when invoking a server->client RPC on Mono. #387

Closed
ILikePizza555 opened this issue Nov 28, 2019 · 5 comments
Assignees
Labels

Comments

@ILikePizza555
Copy link

Minimal source code that reproduces this error: https://github.com/ILikePizza555/StreamJsonRPCTest

This happens on MacOS on the latest version of Mono (6.4.0.198).

Output of the project is

Entered RequestDataFromServerRPC
Entered RequestDataFromClientRPC
RPC Exception: StreamJsonRpc.RemoteInvocationException: Attempted to access an element as a type incompatible with the array.
  at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult] (System.Nullable`1[T] id, System.String targetName, System.Collections.Generic.IReadOnlyList`1[T] arguments, System.Threading.CancellationToken cancellationToken, System.Boolean isParameterObject) [0x0018d] in <ab9df841741b4f729c437e4366755293>:0 
  at SJRTest.Server.RequestDataFromClientRPC (System.String key, System.Threading.CancellationToken ct) [0x0009b] in <33bed87fd5be4d728d3def5bfad1c0af>:0 
Result: 

Obviously, the expected behavior is to not have the exception. The fact that the application does not print out Entered DictionaryDataCallback indicates that this exception is thrown before the method is called.

@AArnott
Copy link
Member

AArnott commented Dec 2, 2019

I am pleased to say this reproduces on Windows with the mono runtime as well.
I'll try to get our unit tests running on mono so we can offer better mono support. But please do file a bug against mono as well and link to this issue so we can track. (I did this already).

@AArnott AArnott self-assigned this Dec 2, 2019
@AArnott
Copy link
Member

AArnott commented Dec 2, 2019

Mono is struggling to run our unit tests for a variety of reasons. For just our JsonRpcJsonHeadersTests class, 31 of 145 tests fail, including with the exception that this issue tracks.

@AArnott
Copy link
Member

AArnott commented Dec 2, 2019

I found an even smaller repro for your project. I've sent a PR.

But really it's just this:

static void Main(string[] args)
{
    var m = typeof(Program).GetMethod(nameof(Foo), BindingFlags.Static | BindingFlags.NonPublic);
    ParameterInfo[] a = m.GetParameters();
    Span<ParameterInfo> s = a.AsSpan(0, 0); // a's runtime type is RuntimeParameterInfo[]
}

static void Foo() { }

@AArnott
Copy link
Member

AArnott commented Dec 2, 2019

I filed mono/mono#17993 to track the defect on mono

@AArnott
Copy link
Member

AArnott commented Dec 2, 2019

I also filed mono/mono#17994 to track the only other defect on mono that I found.

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

No branches or pull requests

2 participants