Code Monkey home page Code Monkey logo

vs-streamjsonrpc's Introduction

vs-StreamJsonRpc

codecov Join the chat at https://gitter.im/vs-streamjsonrpc/Lobby

StreamJsonRpc

NuGet package Build Status

StreamJsonRpc is a cross-platform, .NET portable library that implements the JSON-RPC wire protocol.

It works over Stream, WebSocket, or System.IO.Pipelines pipes, independent of the underlying transport.

Bonus features beyond the JSON-RPC spec include:

  1. Request cancellation
  2. .NET Events as notifications
  3. Dynamic client proxy generation
  4. Support for compact binary serialization via MessagePack
  5. Pluggable architecture for custom message handling and formatting.

Learn about the use cases for JSON-RPC and how to use this library from our documentation.

vs-streamjsonrpc's People

Contributors

49081 avatar aarnott avatar amcasey avatar bertanaygun avatar csigs avatar csiusers avatar danyeh avatar dependabot[bot] avatar dibarbet avatar ilyabiryukov avatar javierdlg avatar jepetty avatar khoiph1 avatar kingosticks avatar kirankulkarni747 avatar matteo-prosperi avatar milopezc avatar noellelc avatar richardstanton avatar robmen avatar rruizgit avatar ryantoth3 avatar shyam-gupta avatar stevebush avatar sylviale191 avatar thompson-tomo avatar tinaschrepfer avatar v-zbsail avatar vivlimmsft avatar wade0016 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vs-streamjsonrpc's Issues

CancellationToken is not honored for sync methods

Because the reader loop executes methods directly within the loop, any sync methods (or async methods before their first yielding await) will never recognize a cancellation request from the client if they were to take a CancellationToken.

We could fix this by invoking methods using Task.Run so that they can't block our reader loop, thus freeing it up to receive the cancellation request. This might break any servers that depend on their sync methods being executed sequentially or in-order since the change would allow multiple sync server methods to execute concurrently.

Design proposal

Add a SynchronizationContext field to the JsonRpc class and all local method invocations will be done by calling SynchronizationContext.Post. This SynchronizationContext will be either the default one (which schedules work concurrently to the threadpool) or one that is "captured" or otherwise provided in the constructor. That way, folks who want to preserve order of incoming messages can do so by supplying a single-threaded SynchronizationContext, but otherwise execution becomes concurrent.
This design will allow even the single threaded servers to observe cancellation requests while sync methods are executing.

CC: @BertanAygun @heejaechang @tinaschrepfer @AlexEyler

Support servers that must be invoked on a captured SynchronizationContext

Add a SynchronizationContext field to the JsonRpc class and all local method invocations will be done by calling SynchronizationContext.Post. This SynchronizationContext will be either the default one (which schedules work concurrently to the threadpool) or one that is "captured" or otherwise provided in the constructor. That way, folks who want to preserve order of incoming messages can do so by supplying a single-threaded SynchronizationContext.

This originally came from #86 but as that was closed as Not Repro, I brought the design idea over here since it is useful for other things too.

Cancellation request may be ignored if it comes just right after the request it cancels

Repro:

  1. Invoke a request with cancellation
  2. Immediately cancel it

Actual:
Intermittently, the cancellation token is ignored and the cancellation is never passed to the server

Expected:
The server method is cancelled

Root Cause:
ReadAndHandleRequestsAsync() kicks off each request on its own thread, and the cancellation request, though arrived second, may be handled faster than the method invocation, and may not find its id in inboundCancellationSources, and won't be able to cancel it.

Process crash when RPC error message is received without stack field

We have a crash dump where this JSON message is received by the Visual Studio process:

{
  "jsonrpc": "2.0",
  "id": 3,
  "error": {
    "code": -32000,
    "message": "Object reference not set to an instance of an object.",
    "data": {
      "stack": "   at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.GetProjectScope()\r\n   at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<DetermineAllSymbolsCoreAsync>d__20.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<DetermineAllSymbolsAsync>d__19.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<FindReferencesAsync>d__10.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<FindReferencesAsync>d__10.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.<FindReferencesAsync>d__13.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.CodeAnalysis.DocumentHighlighting.AbstractDocumentHighlightsService.<GetTagsForReferencedSymbolAsync>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.CodeAnalysis.DocumentHighlighting.AbstractDocumentHighlightsService.<GetDocumentHighlightsInCurrentProcessAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.CodeAnalysis.DocumentHighlighting.AbstractDocumentHighlightsService.<GetDocumentHighlightsAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.CodeAnalysis.Remote.CodeAnalysisService.<GetDocumentHighlightsAsync>d__5.MoveNext()",
      "code": "-2147467261"
    }
  }
}

The crashing exception is:

+		$exception	{"'Newtonsoft.Json.Linq.JObject' does not contain a definition for 'stack'"}	Microsoft.CSharp.RuntimeBinder.RuntimeBinderException

 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.RuntimeBinderController.SubmitError(Microsoft.CSharp.RuntimeBinder.Errors.CError pError) Line 19	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.Semantics.LangCompiler.SubmitError(Microsoft.CSharp.RuntimeBinder.Errors.CParameterizedError error) Line 68	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.Errors.ErrorHandling.ErrorTreeArgs(Microsoft.CSharp.RuntimeBinder.Errors.ErrorCode id, Microsoft.CSharp.RuntimeBinder.Errors.ErrArg[] prgarg) Line 102	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.Semantics.MemberLookup.ReportErrors() Line 845	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindProperty(System.Dynamic.DynamicMetaObjectBinder payload, Microsoft.CSharp.RuntimeBinder.RuntimeBinder.ArgumentObject argument, Microsoft.CSharp.RuntimeBinder.Semantics.LocalVariableSymbol local, Microsoft.CSharp.RuntimeBinder.Semantics.EXPR optionalIndexerArguments, bool fEventsPermitted) Line 1791	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.RuntimeBinder.DispatchPayload(System.Dynamic.DynamicMetaObjectBinder payload, Microsoft.CSharp.RuntimeBinder.RuntimeBinder.ArgumentObject[] arguments, System.Collections.Generic.Dictionary<int, Microsoft.CSharp.RuntimeBinder.Semantics.LocalVariableSymbol> dictionary) Line 699	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindCore(System.Dynamic.DynamicMetaObjectBinder payload, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> parameters, System.Dynamic.DynamicMetaObject[] args, out System.Dynamic.DynamicMetaObject deferredBinding) Line 246	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.RuntimeBinder.Bind(System.Dynamic.DynamicMetaObjectBinder payload, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> parameters, System.Dynamic.DynamicMetaObject[] args, out System.Dynamic.DynamicMetaObject deferredBinding) Line 172	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind(System.Dynamic.DynamicMetaObjectBinder action, Microsoft.CSharp.RuntimeBinder.RuntimeBinder binder, System.Collections.Generic.IEnumerable<System.Dynamic.DynamicMetaObject> args, System.Collections.Generic.IEnumerable<Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo> arginfos, System.Dynamic.DynamicMetaObject onBindingError) Line 38	C#
 	Microsoft.CSharp.dll!Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder.FallbackGetMember(System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject errorSuggestion) Line 68	C#
 	Newtonsoft.Json.dll!Newtonsoft.Json.Utilities.DynamicProxyMetaObject<System.__Canon>.BindGetMember.AnonymousMethod__0(System.Dynamic.DynamicMetaObject e) Line 61	C#
 	Newtonsoft.Json.dll!Newtonsoft.Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.CallMethodWithResult(string methodName, System.Dynamic.DynamicMetaObjectBinder binder, System.Linq.Expressions.Expression[] args, Newtonsoft.Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.Fallback fallback, Newtonsoft.Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.Fallback fallbackInvoke) Line 220	C#
 	Newtonsoft.Json.dll!Newtonsoft.Json.Utilities.DynamicProxyMetaObject<Newtonsoft.Json.Linq.JObject>.BindGetMember(System.Dynamic.GetMemberBinder binder) Line 60	C#
 	System.Core.dll!System.Dynamic.GetMemberBinder.Bind(System.Dynamic.DynamicMetaObject target, System.Dynamic.DynamicMetaObject[] args) Line 90	C#
 	System.Core.dll!System.Dynamic.DynamicMetaObjectBinder.Bind(object[] args, System.Collections.ObjectModel.ReadOnlyCollection<System.Linq.Expressions.ParameterExpression> parameters, System.Linq.Expressions.LabelTarget returnLabel) Line 107	C#
 	System.Core.dll!System.Runtime.CompilerServices.CallSiteBinder.BindCore<System.Func<System.Runtime.CompilerServices.CallSite, object, object>>(System.Runtime.CompilerServices.CallSite<System.Func<System.Runtime.CompilerServices.CallSite, object, object>> site, object[] args) Line 130	C#
 	System.Core.dll!System.Dynamic.UpdateDelegates.UpdateAndExecute1<object, object>(System.Runtime.CompilerServices.CallSite site, object arg0) Line 254	C#
 	StreamJsonRpc.dll!StreamJsonRpc.JsonRpcError.ErrorStack.get() Line 29	C#
 	StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.CreateExceptionFromRpcError(StreamJsonRpc.JsonRpcMessage response, string targetName) Line 756	C#
 	StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.InvokeCoreAsync.AnonymousMethod__0(StreamJsonRpc.JsonRpcMessage response) Line 636	C#
>	StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.HandleRpcAsync(string json) Line 1021	C#
 	StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.ReadAndHandleRequestsAsync.AnonymousMethod__0()	C#
 	mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.Task>.InnerInvoke() Line 680	C#
 	mscorlib.dll!System.Threading.Tasks.Task.Execute() Line 2498	C#
 	mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj) Line 2861	C#
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 954	C#
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 902	C#
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot) Line 2827	C#
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Line 2767	C#
 	mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() Line 2704	C#
 	mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Line 820	C#
 	mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() Line 1161	C#
 	[Native to Managed Transition]	

Unstable test: JsonRpcTests.CancelMessageSentWhileAwaitingResponse

The test below failed this appveyor build, then succeeded later on a rebuild of the same commit.

JsonRpcTests.CancelMessageSentWhileAwaitingResponse [FAIL]
    Assert.Throws() Failure
    Expected: typeof(StreamJsonRpc.RemoteInvocationException)
    Actual:   typeof(System.TimeoutException): The operation has timed out.
    Stack Trace:
        at Microsoft.VisualStudio.Threading.TplExtensions.<WithTimeout>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
        at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
        at Microsoft.VisualStudio.Threading.TplExtensions.<WithTimeout>d__7`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
        at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
        at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

throw cancellation exception from given cancellation token for cancellation rather than RemoveInvocationException

currently, when InvokeWithCancellationAsync is called, if call is cancelled by cancellation token, it throws RemoteInvocationException rather than cancellation exception from the token given.

since it is StreamJsonRpc which propagate cancellation message to other side, when other side return due to it, it should know exactly why it got back and it has cancellation token in hand.

I think it should call cancellationToken.ThrowIfCancelled() first and then throw new RemoteInvocationException if cancellationtoken is not raised.

error.data in responses is not available in exceptions thrown

All the goodness the server may have returned in the error.data field is not exposed to the client unless it happens to match a very limited schema we expect for callstacks and error codes.

We should expose the JToken for the data field so they can read any of it.

Unstable test: InvokeWithCancellationAsync_CancellableMethodWithoutCancellationToken

Failed on Travis:

[xUnit.net 00:00:12.8769420]     JsonRpcTests.InvokeWithCancellationAsync_CancellableMethodWithoutCancellationToken [FAIL]
Failed   JsonRpcTests.InvokeWithCancellationAsync_CancellableMethodWithoutCancellationToken
Error Message:
 Assert.True() Failure
Expected: True
Actual:   False
Stack Trace:
   at TestBase.CheckGCPressureAsync(Func`1 scenario, Int32 maxBytesAllocated, Int32 iterations, Int32 allowedAttempts) in /Users/travis/build/Microsoft/vs-streamjsonrpc/src/StreamJsonRpc.Tests/TestBase.cs:line 103
   at JsonRpcTests.InvokeWithCancellationAsync_CancellableMethodWithoutCancellationToken() in /Users/travis/build/Microsoft/vs-streamjsonrpc/src/StreamJsonRpc.Tests/JsonRpcTests.cs:line 731
--- End of stack trace from previous location where exception was thrown ---
Standard Output Messages:
 Attempt 1
 27260 bytes leaked per iteration.
 89019 bytes allocated per iteration (unlimited allowed).
 Attempt 2
 89462 bytes leaked per iteration.
 170832 bytes allocated per iteration (unlimited allowed).
 Attempt 3
 22 bytes leaked per iteration.
 26792 bytes allocated per iteration (unlimited allowed).
 Attempt 4
 10 bytes leaked per iteration.
 26855 bytes allocated per iteration (unlimited allowed).
 Attempt 5
 10 bytes leaked per iteration.
 26683 bytes allocated per iteration (unlimited allowed).
 Attempt 6
 10 bytes leaked per iteration.
 26963 bytes allocated per iteration (unlimited allowed).
 Attempt 7
 10 bytes leaked per iteration.
 26706 bytes allocated per iteration (unlimited allowed).
 Attempt 8
 10 bytes leaked per iteration.
 26931 bytes allocated per iteration (unlimited allowed).
 Attempt 9
 10 bytes leaked per iteration.
 26737 bytes allocated per iteration (unlimited allowed).
 Attempt 10
 10 bytes leaked per iteration.
 26857 bytes allocated per iteration (unlimited allowed).

Examples

Hi,
It would be great if examples are provided for RPC Server Hosted in IIS + VB/C# client.

Thanks

Support for out of band streams referenced in JSON-RPC messages

Proposal

When a server method signature includes a Stream, it signifies that a side-channel should be established between the two parties. This is useful for efficient transfer of large binary blobs or any other one- or two-way communication that should take place outside the standard JSON-RPC protocol.

The method and transport used to create the side-channel is outside the scope of this spec, but may be established on the same underlying transport by leveraging a multiplexing stream (such as the one implemented in Nerdbank.Streams) or as an entirely new connection.

For example, given a server method signature such as this:

async Task SaveJpgContent(string fileName, Stream stream);

A client may invoke it like this:

await jsonRpcClient.InvokeAsync("SaveJpgContent", fileName,  File.OpenRead(fileName));

The client library then takes the Stream that is passed to it, creates a side-channel, and sends the side-channel id to the server:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "TakeThisOfflineAsync",
  "params": [
    "some.jpg",
    15 // supposing the side-channel ID is 15
  ]
}

The server library would receive this request, find the matching method and notice that the second parameter is a Stream, and interpret the 15 in the request as a side-channel id and accept the connection to that channel. It would then provide the stream that represents that channel as the second argument when it actually invokes the server method locally.

At this point, the server method can read from the stream.

Additional notes

For two-way communication, the Stream a client passes into the library would have to be prepared for the library to potentially read from and write to in order to propagate information from the side-channel. But this leaves the question of how the client itself communicates since both Read and Write methods must be used by the library. This might be resolved by passing in one of the Streams created by FullDuplexStream, and keeping the other Stream in the pair for communication.

Open questions

  1. Must the server complete using the stream before sending the JSON-RPC response message? I'm thinking not since I can't think of a reason why that would be a necessary restriction. But servers may certainly choose to complete all side-channel communication before returning from their async methods and sending the JSON-RPC response to the client.
  2. Some libraries are not in strongly typed languages. How would a javascript implementation know to convert the 15 to a Stream? Perhaps this whole automatic feature can be provided only in a strongly-typed library, while maintaining wire compatibility with loosely-typed languages since they can still accept the side-channel by expecting 15 to be interpreted as its id.
  3. How might we work the new System.IO.Pipelines API into these server methods?

Spec proposal: support for IProgress<T>

The following is a proposal for an extension to the JSON-RPC protocol that serves as a means for a server to provide progress reports on an invoked method to the client, leading to a final result.

In C#, this might be expressed as IProgress<T>. A server method signature might take this form:

async Task DoSomeHeavyWorkAsync(int units, IProgress<WorkUpdate> progress);

A request might look like this:

{
  "jsonrpc": "2.0",
  "id": 153,
  "method": "someMethodName",
  "params": {
    "units": 5,
    "progress": "some-JSON-token"
  }
}

The progress argument may have any name or position, and may have any valid JSON token as its value. A value of null is specially recognized as an indication that the client does not want progress updates from the server. This argument may not be recognizable as an IProgress<T> token from the request, but the JSON-RPC library can offer a means for an application to specify that this argument is used as a progress token during a callback to the client.

For instance, in the above C# method signature, the IProgress<WorkUpdate> parameter type would signify to the JSON-RPC library that it should reinterpret the second/"progress" argument as a progress token and instantiate an IProgress<WorkUpdate> instance whose Report method will send the response message as specified below, carrying that token.

A JSON-RPC client may find it convenient to simply reuse the value from the id in the request itself, but may choose to avoid this so that multiple progress arguments can be passed in via the same request. This would enable different progress updates or frequencies to be supplied at the client's discretion. The progress token SHOULD be unique to the session so that any progress callbacks from the server can be distinctly routed to the right handler on the client side.

In processing such a message, the server provides updates to the client via a notification sent back to the client. These notifications use the special method name $/progress. For example:

{
  "jsonrpc": "2.0",
  "method": "$/progress",
  "params": {
    "token": "some-JSON-token",
    "value": { "some": "status-token" }
  }
}

Parameters are (progressToken, value), which may be named in a params object or as a params array in that order. progressToken must match the value of the argument from the request that progress is being reported for. The value property in this $/progress message may be set to any json token representing the update from the server. It may be a number, string, bool, object, or even the null literal.

Implementation notes

It is conceivable that client applications of a JSON-RPC library that supports this feature would expect that progress notifications are raised to the application in order, and possibly all before the outbound RPC call is marked completed. In multi-threaded environments this can introduce special considerations. In .NET for example, the IProgress<T> interface makes such guarantees hard, and we'll likely need to document that folks use a particular implementation of that interface that guarantees ordering, and also suggest ways to mitigate the chance of their async call completing before the last progress message has been recognized by the client.

Log interface needed in vs-streamjsonrpc

Ideally I think JsonRpc should provide some way to let caller to add logging/tracing (error, info).

In my example, when JsonRpc Server has some error executing some RPC call, it will only transmit the exception back to the client while Server does not know what error happens at all. It would be great to provide a way to let Server to log these errors or info.

Today, it is more popular to add telemetry and tracing to identify issues and bugs. It would be great to have such functionalities.

Error messages where error.data is a string fail to deserialize

The Java language server sends error responses where the data field on an error object is a javascript string instead of the javascript object that we expect. This leads to StreamJsonRpc deciding a protocol violation has occurred and terminates the connection completely instead of simply forwarding the exception to the caller of the request that produced the failure.

Per the spec any primitive or structured value is allowed in the data field.

Methods on System.Object should not be invokable by RPC client

When attaching/constructing JsonRpc with target, all methods are registered into requestMethodToClrMethodMap. Providing more control over this process would be welcome and more safe at the same time.
Even when using separate class which provides only desired methods, also object base methods like 'ToString' are registered.

Example: registering test class with methods:
TestMethod0, TestMethod1, TestMethod2, TestMethod3

Full list of extra methods:
GetHashCode, GetType, Equals, ToString, ReferenceEquals, Finalize, MemberwiseClone, FieldSetter, FieldGetter, GetFieldInfo

This, depending on the actual implementation, is a vulnerability.

My suggestion is to provide new (or extend existing JsonRpcMethodAttribute), which is mandatory for each method published over JsonRPC.

Updating Public API files

While building I found that VS throws the following warinings:

1>PublicAPI.Shipped.txt(50,1,50,182): warning RS0017: Symbol 'StreamJsonRpc.RemoteInvocationException.RemoteInvocationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void' is part of the declared API, but is either not public or could not be found
1>PublicAPI.Shipped.txt(54,1,54,190): warning RS0017: Symbol 'StreamJsonRpc.RemoteMethodNotFoundException.RemoteMethodNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void' is part of the declared API, but is either not public or could not be found
1>PublicAPI.Shipped.txt(57,1,57,168): warning RS0017: Symbol 'StreamJsonRpc.RemoteRpcException.RemoteRpcException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void' is part of the declared API, but is either not public or could not be found
1>PublicAPI.Shipped.txt(61,1,61,186): warning RS0017: Symbol 'StreamJsonRpc.RemoteTargetNotSetException.RemoteTargetNotSetException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) -> void' is part of the declared API, but is either not public or could not be found

One of these is declared in the PublicAPI.Shipped.txt file and if so it should not have been removed. The ones in the PublicAPI.Unshipped.txt can be removed but I didn't want to do it myself since I didn't remove them originally.

JsonRpcErrorCode's should not define non-spec'd error codes

When using StreamJsonRpc as a client for JSON-RPC server implemented by another library, the server returned a -32001 error code, which StreamJsonRpc incorrectly interpreted as NoCallbackObject and threw the wrong exception based on that.

These error codes from JsonRpcErrorCode are defined in the implementation-defined server-errors range, which should mean we're doing this correctly, but the Java language server was perhaps inappropriately using this same range instead of the app-level range outside of [-32768, -32000].

        /// <summary>
        /// Indicates the RPC call was made but the target threw an exception.
        /// </summary>
        InvocationError = -32000,

        /// <summary>
        /// No callback object was given to the client but an RPC call was attempted.
        /// </summary>
        NoCallbackObject = -32001,

Unstable test: ErrorResponseOmitsDataObject

As recorded here:

    JsonRpcClientInteropTests.ErrorResponseOmitsDataObject [FAIL]
      System.Threading.Tasks.TaskCanceledException : A task was canceled.
      Stack Trace:
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
        src\StreamJsonRpc.Tests\InteropTestBase.cs(58,0): at InteropTestBase.<ReceiveAsync>d__7.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
        src\StreamJsonRpc.Tests\JsonRpcClientInteropTests.cs(254,0): at JsonRpcClientInteropTests.<ErrorResponseOmitsDataObject>d__17.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
        --- End of stack trace from previous location where exception was thrown ---
           at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
           at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
           at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

Add Headers support for WebSocketMessageHandler

I am using vscode-ws-jsonrpc from client side and using vs-streamjsonrpc from server side. The communication is through WebSocket.

While vscode-ws-jsonrpc always expect headers in the message (sending and receiving)

Could you please abstract the Headers feature from HeaderDelimitedMessageHandler and make it to be configurable for these message handlers so that we can enable /disable as needed for different jsonrpc libs?

HeaderDelimitedMessageHandler may write only header but not the body when the request is cancelled

Repro:
Invoke a method on a server and then cancel the cancellation token passed to the method. Depending on your luck, the cancellation may happen so that the header is already written to the underlying stream here, but the content is not, and it got cancelled here. Sending another message on that JsonRPC makes it send the header and the content. The receiving end will get the header from the first (cancelled) message, and then the header and the content from the next message. It'll try to use the first header to read the whole message, and will read malformed json (it will contain the header and part of the body of the second message). Then it'll close the stream.

Expected:
Sending a JSON RPC message by the message handler should be atomic. We should write header and content together, or don't write anything at all.

High lock contention in Roslyn DelimitedMessageHandler

From a discussion with @AArnott ,

I'm seeing super high CPU utilization in VS when we use StreamRPC to talk to our OOP server. ETW logs reveal this as the top exclusive problem:

Iโ€™m investigating some local traces that show high CPU usage in VS during OOP scenarios. The traces end up showing a large amount of time around locks and contention:

--

image

Thatโ€™s 18% exclusive time in VS time just around these locking primitives. Looking into what calls this I can see the following:

image

And

image

Refactor DelimitedMessageHandler so it is Stream-agnostic

We have at least one user that wants to use this library over a WebSocket, which is not exposed as a Stream. StreamJsonRpc can work with this by deriving from DelimitedMessageHandler, but it requires faking out the DelimitedMessageHandler with Stream.Null instances in order to indirectly control the return values of the CanRead and CanWrite properties.

When we have a chance for some minor binary breaking changes, we may want to refactor this class so that implementations that aren't dependent on Stream will work.

Server methods that return Task fail

When a JSON-RPC server method return an instance of Task (itself -- not a derived type), the JsonRpc server that invoked the method fails to deal with that result and returns an error message to the client.

This was regression in v1.4

What WebSocket library is suggested to integrate with vs-streamjsonrpc

I am trying to look a mature WebSocket library to use with vs-streamjsonrpc. There are a couple of choices search from GitHub and I noticed that some implementation is not thread thread.

So it will be an issue when integrate with vs-streamjosnrpc as this library is non-blocking to accept RPC calls and can reply responses in different threads.

Is there any suggestion about which WebSocket library to use?

Thanks very much.

Read- and Write- buffering stream classes are not provided/inaccessible

While it is possible to implement own transport protocol by extending DelimitedMessageHandler, the class ReadBufferingStream is made internal to the library.
Moreover, write buffering class would be welcome in order to increase efficiency when using network streams (like SslStream).

Writing and flushing each message separately, like in HeaderDelimitedMessageHandler.cs lines 240-242 is suboptimal, especially for large quantity of small messages.

            // Transmit the content itself.
            await this.SendingStream.WriteAsync(contentBytes, 0, contentBytes.Length, cancellationToken).ConfigureAwait(false);
            await this.SendingStream.FlushAsync().ConfigureAwait(false);

Note: Simply using BufferedStream does not solve the whole problem, as flushing it per each call will introduce the same inefficiency and not-flushing it right away brings the question where and when to do it.

Proxy generator for interfaces

Consider offering a code generator to produce proxy stubs automatically given an interface. We might support events on that interface as a way to express callbacks (via notify messages) to the client.

Cascade does this and likes it.

allow StreamJsonRpc to raise cancellation when caller side close the connection

I see that, if I raise cancellation and close Rpc connection right away, sometimes, cancellation message doesn't reach server side before Rpc connection is disconnected. making server side not know the operation is actually cancelled.

for us, this is bad since we are waiting for other connection to happen inside of service hub, and hang there since it doesn't know the operation is actually cancelled.

I think StreamJsonRpc should either guarantee of ordering (cancellation and disconnect) or give a way to configure streamJsonRpc to always raise cancellation if connection is disconnected.

Failure returning result of async method on .NET Core 2.1

A Task<T> returning async method compiled with C# 7.3 and running on .NET Core 2.1 actually returns an instance of System.Runtime.CompilerServices.AsyncTaskMethodBuilder1+AsyncStateMachineBox`.

JsonRpc.HandleInvocationTaskResult uses reflection to acquire the value of Task<T>.Result in such a way that if a Task<T>-derived type is returned, it fails to find the Result property and returns null back to the caller.

https://github.com/Microsoft/vs-streamjsonrpc/blob/b770d6bf7cf05a1a6b9bbb83910bab05e0032b9c/src/StreamJsonRpc/JsonRpc.cs#L1194-L1195

Allow for custom message routing/handling

Requirements

  1. A specially initialized JsonRpc object may send messages that are routed in a non-standard way. For example, sent messages may be routed to different recipients depending on the method name.
  2. A specialized router that receives and forwards JSON-RPC messages to various destinations, possibly changing their contents along the way. One destination may be a "local" JsonRpc instance.

Rough notes from earlier:

  1. โœ”๏ธ Revise DelimitedMessageHandler contract to convert between JObject and the transport (consider #80) instead of a single string containing the entire message.
  2. โœ”๏ธ Allow for a plugin serializer to convert between JToken and byte[] (on the stream). The idea being to support a binary serialization later on as an option. โ“ But web sockets probably would prefer to remain encoded as text rather than as binary, so how would that work? Perhaps we don't know whether it's a string or byte[] on the transport side. We just give and receive JToken objects with this plugin and it serializes it to the transport however it wants? But that couples the serializer to the transport. ๐Ÿ‘Ž
  3. โŒ Allow 'middleware' to intercept JObject being written or read and choose to transform it, or redirect it.
  4. โœ”๏ธ Alternative to intercepting/passing around JObject would be to let our own strongly typed JSON-RPC classes (JsonRpcMessage, JsonRpcError, etc.) be the medium of exchange.

Suggestion: JsonRpc message handler extensibility

Sometimes target object may want to handle JsonRpcMessage and do its own processing. Right now there is no way users can do that.
If users can supply something like IJsonRpcMessageHandler in place of target object, then they would be able to handle the messages themselves. JsonRpc itself can implement the interface too

Here is an example of such interface:
https://devdiv.visualstudio.com/DevDiv/_git/CascadePrototype/pullrequest/80621?_a=files&path=%2FJsonRpc%2FIRpcService.cs

Cannot invoke a method that contains just the CancellationToken parameter

I have a method with a following signature: public void Method(CancellationToken token) => DoSomething();.

I tried to invoke this method with cancellation and pass an empty parameter array. However, this results in an exception:

StreamJsonRpc.RemoteInvocationException: Parameter count mismatch.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__63`1.MoveNext()
   at 

After debugging this I noticed that JsonRpcMessage.GetParameters method returns an empty object array for parameters (instead of an array with one item left for the cancellation token) and as a result invoking the method throws the exception.

I also tried to pass null or the cancellation token as a parameter, but this failed the check that validates the parameter count in TargetMethod.TryGetParameters (if (paramCount < method.RequiredParamCount || paramCount > method.TotalParamCountExcludingCancellationToken)).

Unstable test: AspNetCoreWebSocket_DisposeRpcThenCloseSocket

From this CI build:

[xUnit.net 00:00:02.6542180]     WebSocketMessageHandlerTests.AspNetCoreWebSocket_DisposeRpcThenCloseSocket [FAIL]
Failed   WebSocketMessageHandlerTests.AspNetCoreWebSocket_DisposeRpcThenCloseSocket
Error Message:
 System.ObjectDisposedException : Cannot access a disposed object.
Object name: 'Microsoft.AspNetCore.TestHost.TestWebSocket'.
Stack Trace:
   at Microsoft.AspNetCore.TestHost.TestWebSocket.ReceiverSenderBuffer.ThrowNoReceive()
   at Microsoft.AspNetCore.TestHost.TestWebSocket.ReceiverSenderBuffer.<ReceiveAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.TestHost.TestWebSocket.<ReceiveAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.TestHost.TestWebSocket.<CloseAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at WebSocketMessageHandlerTests.<AspNetCoreWebSocket_DisposeRpcThenCloseSocket>d__21.MoveNext() in /Users/travis/build/Microsoft/vs-streamjsonrpc/src/StreamJsonRpc.Tests/WebSocketMessageHandlerTests.cs:line 185
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Offer option to let a server method's unhandled exception crash the process

StreamJsonRpc typically catches any exception thrown by the RPC-invoked server method and serializes the exception into a message sent back to the client, per the json-rpc spec.

For servers that would rather crash when they throw an unhandled exception, the JsonRpc class should expose an option to do that. I would propose a property:

public enum LocalInvocationExceptionBehavior
{
    /// <summary>
    /// Catch any exception thrown by a local method and transmit it to the remote party in a JSON-RPC error message. The stream is kept open and incoming calls continue to be routed.
    /// </summary>
    TransmitErrorMessageAndContinue,

    /// <summary>
    /// Close the stream to the remote party and crash the process.
    /// </summary>
    CloseStreamAndFailFast,
}

public class JsonRpc
{
    // ....

    public LocalInvocationExceptionBehavior LocalErrorHandling { get; set; }
}

StreamJsonRpc.1.4.46-beta cannot run from Xamarin.Mac application

I verified that when use StreamJsonRpc.1.4.46-beta from Xamarin.Mac application, it crashes WebSocketMessageHandler calling in mono.

My application is running on Mono .Net 4.5

I see that this project uses some syntax that mono runtime does not support.

018-05-04 13:10:50.898 Microsoft Bing Ads Editor[30065:392079] error: * Assertion at /Users/builder/data/lanes/3985/ba11e481/source/xamarin-macios/external/mono/mono/mini/method-to-ir.c:14245, condition `ins->opcode >= MONO_CEE_LAST' not met
Stacktrace:

  at <unknown> <0xffffffff>
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<StreamJsonRpc.WebSocketMessageHandler/<WriteCoreAsync>d__8> (StreamJsonRpc.WebSocketMessageHandler/<WriteCoreAsync>d__8&) [0x00031] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
  at StreamJsonRpc.WebSocketMessageHandler.WriteCoreAsync (string,System.Text.Encoding,System.Threading.CancellationToken) [0x0003f] in <7155b30225204b6dad7069b587012301>:0
  at StreamJsonRpc.DelimitedMessageHandler/<WriteAsync>d__23.MoveNext () [0x0011d] in <7155b30225204b6dad7069b587012301>:0
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<StreamJsonRpc.DelimitedMessageHandler/<WriteAsync>d__23> (StreamJsonRpc.DelimitedMessageHandler/<WriteAsync>d__23&) [0x00031] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
  at StreamJsonRpc.DelimitedMessageHandler.WriteAsync (string,System.Threading.CancellationToken) [0x00037] in <7155b30225204b6dad7069b587012301>:0
  at StreamJsonRpc.JsonRpc.TransmitAsync (StreamJsonRpc.JsonRpcMessage,System.Threading.CancellationToken) [0x0001b] in <7155b30225204b6dad7069b587012301>:0
  at StreamJsonRpc.JsonRpc/<HandleRpcAsync>d__91.MoveNext () [0x001ed] in <7155b30225204b6dad7069b587012301>:0
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at StreamJsonRpc.JsonRpc/<DispatchIncomingRequestAsync>d__87.MoveNext () [0x003b0] in <7155b30225204b6dad7069b587012301>:0
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task.FinishStageTwo () [0x000f8] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2339
  at System.Threading.Tasks.Task.Finish (bool) [0x00049] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2239
  at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task&) [0x00079] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2834
  at System.Threading.Tasks.Task.ExecuteEntry (bool) [0x0006f] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2760
  at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline (System.Threading.Tasks.Task,bool) [0x00015] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/ThreadPoolTaskScheduler.cs:91
  at System.Threading.Tasks.TaskScheduler.TryRunInline (System.Threading.Tasks.Task,bool) [0x00061] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskScheduler.cs:219
  at System.Threading.Tasks.TaskContinuation.InlineIfPossibleOrElseQueue (System.Threading.Tasks.Task,bool) [0x0002d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:263
  at System.Threading.Tasks.StandardTaskContinuation.Run (System.Threading.Tasks.Task,bool) [0x00093] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:356
  at System.Threading.Tasks.Task.FinishContinuations () [0x000cf] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3649
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.AdvertisingDesktop.BingAdsEditor.RPC.JsonRpcServer/<CallEntityService>c__async0.MoveNext () [0x00142] in /Users/yvonnedu/Source/BAE/src/ui/Shared/RPC/ServiceServer.cs:29
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.AdvertisingDesktop.BingAdsEditor.RPC.RPCCampaignService/<GetEntities>c__async1.MoveNext () [0x00529] in /Users/yvonnedu/Source/BAE/src/ui/Shared/RPC/RPCMockCampaignService.cs:53
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.AdvertisingDesktop.ClientServices.CampaignService/<FetchAllForAccount>c__async11`1<TResult_REF>.MoveNext () [0x0015b] in /Users/yvonnedu/Source/BAE/src/businesslogic/ClientServices/CampaignService.cs:1674
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.Advertising.DataServices.GenericDataService/<ReadIntoAsync>c__async3`4<TBusinessObject_REF, TDataObject_REF, TEFDataObject_REF, TResultObject_REF>.MoveNext () [0x00191] in /Users/yvonnedu/Source/BAE/src/db/DataServices/GenericDataService.cs:173
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.Advertising.DataServices.GenericDataService/<Instrument>c__async35`3<TResult_REF, TBusinessObject_REF, TDataObject_REF>.MoveNext () [0x000b2] in /Users/yvonnedu/Source/BAE/src/db/DataServices/GenericDataService.cs:1530
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.Advertising.Instrumentation.FeatureOperationsIntrumentor/<InstrumentAsync>c__async0`1<TResult_REF>.MoveNext () [0x002be] in /Users/yvonnedu/Source/BAE/src/appmodel/LoggingLibrary/Instrument/Instrumentor/FeatureOperationsIntrumentor.cs:109
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.Advertising.DataServices.GenericDataService/<ReadIntoInnerAsync>c__async6`4<TBusinessObject_REF, TDataObject_REF, TEFDataObject_REF, TResultObject_REF>.MoveNext () [0x000f6] in /Users/yvonnedu/Source/BAE/src/db/DataServices/GenericDataService.cs:249
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.AdvertisingDesktop.DataAccessLayer.GenericDataObjectService`2/<ReadIntoAsyncWithJoinFilter>c__async2`1<TDataObject_REF, TEFDataObject_REF, TResultObject_REF>.MoveNext () [0x001d3] in /Users/yvonnedu/Source/BAE/src/db/DataAccessLayer/GenericDataObjectService/GenericDataObjectService.cs:393
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.AdvertisingDesktop.DataAccessLayer.ContextExtensions/<ExecuteAsyncWithCancellation>c__async0`1<TResult_REF>.MoveNext () [0x00114] in /Users/yvonnedu/Source/BAE/src/db/DataAccessLayer/ExtendedQueries/ContextExtensions.cs:37
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task`1<TResult_REF>.TrySetResult (TResult_REF) [0x00058] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Future.cs:488
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>.SetResult (TResult_REF) [0x0004b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:608
  at Microsoft.AdvertisingDesktop.DataAccessLayer.DataProvider.CancellationHandler/<ExecuteAsync>c__async0`1<T_REF>.MoveNext () [0x001a7] in /Users/yvonnedu/Source/BAE/src/db/DataProvider/CancellationHandler.cs:93
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.InvokeMoveNext (object) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1089
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x0008d] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:904
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner.Run () [0x0003b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1070
  at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:821
  at System.Threading.Tasks.Task.FinishContinuations () [0x0007a] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3624
  at System.Threading.Tasks.Task.FinishStageThree () [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2366
  at System.Threading.Tasks.Task.FinishStageTwo () [0x000f8] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2339
  at System.Threading.Tasks.Task.Finish (bool) [0x00049] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2239
  at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task&) [0x00079] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2834
  at System.Threading.Tasks.Task.ExecuteEntry (bool) [0x0006f] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2760
  at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2707
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:854
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00030] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.0.0.398/src/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1209
  at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) [0x0001f] in <f907cb1a62cf4887ae8c2f003ce661d7>:0

Native stacktrace:

	0   Microsoft Bing Ads Editor           0x000000010f38481a mono_handle_native_sigsegv + 282
	1   libsystem_platform.dylib            0x00007fff635faf5a _sigtramp + 26
	2   ???                                 0x000000010f897810 0x0 + 4555634704
	3   libsystem_c.dylib                   0x00007fff633981ae abort + 127
	4   Microsoft Bing Ads Editor           0x000000010f28c5e0 _ZL12log_callbackPKcS0_S0_iPv + 64
	5   Microsoft Bing Ads Editor           0x000000010f51f433 monoeg_g_logv + 83
	6   Microsoft Bing Ads Editor           0x000000010f51f64f monoeg_assertion_message + 143
	7   Microsoft Bing Ads Editor           0x000000010f34ee96 mono_handle_global_vregs + 1622
	8   Microsoft Bing Ads Editor           0x000000010f39f45f mini_method_compile + 5071
	9   Microsoft Bing Ads Editor           0x000000010f3a1e74 mono_jit_compile_method_inner + 676
	10  Microsoft Bing Ads Editor           0x000000010f39148a mono_jit_compile_method_with_opt + 666
	11  Microsoft Bing Ads Editor           0x000000010f3975f9 common_call_trampoline + 1161
	12  Microsoft Bing Ads Editor           0x000000010f397139 mono_magic_trampoline + 73
	13  ???                                 0x000000010f83729e 0x0 + 4555240094
	14  ???                                 0x000000014081208a 0x0 + 5377171594
	15  ???                                 0x0000000140811d18 0x0 + 5377170712
	16  ???                                 0x000000014080fe4a 0x0 + 5377162826
	17  ???                                 0x000000014080fad9 0x0 + 5377161945
	18  ???                                 0x000000011e75b2f5 0x0 + 4805997301

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Suggestion: prefix-based server routing

Sometimes multiple json rpc servers have to share the same stream. If we want to support multiplexing of the servers, we should be able to distinguish them. One way to do that is to have a prefix in the method name. On json rpc level, server A with method Foo will have "A.Foo" method, and server B - "B.Foo".

StreamJsonRpc servers then can add multiple targets and supply prefix for each one for the routing.

May I compile it in .NET4?

My App may be used in the Window XP. But Window XP support the last .NET version is .NET4. How can I complie vs-streamjsonrpc in .NET4? I need to remove the context Header, and build it for Windows XP.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.