We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I can make a call...BUT I get an exception:
Note: the call continues in the background while this exception has stopped execution of the program
Looks like if I want to use .NET Core, I have to change how the async calls are done:
https://devblogs.microsoft.com/dotnet/migrating-delegate-begininvoke-calls-for-net-core/
The fix appears to be relatively simple. Here are the necessary changes:
async public Task<bool> Initialize() { ... /* _workerThread = new Thread(ProcessTapiMessages) { Name = "Tapi Message Processor", IsBackground = true, }; _workerThread.Start(); */ var _workerTask = new Task(async () => { await ProcessTapiMessages(); }); _workerTask.Start(); ... } async private Task ProcessTapiMessages() { ... /* ptmCb.BeginInvoke(msg, ar => { try { ptmCb.EndInvoke(ar); } catch (Exception ex) { Trace.WriteLine("TAPI message exception: " + ex.Message); } }, null); */ // invoke and await delegate await Task.Run(() => { try { ptmCb.Invoke(msg); } catch (Exception ex) { Trace.WriteLine("TAPI message exception: {0}", ex.Message); } }); ... }
in TapiManager.cs
Now I no longer get the exception, and the call continues normally. Both the async changes were required, or else the UI would hang.
This fix should be compatible with existing applications, and now it supports .NET Core!
The text was updated successfully, but these errors were encountered:
Same problem in TapiLine.cs
private async Task HandleNewCall(TapiCall call, int callPrivileges) { if (NewCall != null) { Privilege priv = callPrivileges == NativeMethods.LINECALLPRIVILEGE_NONE ? Privilege.None : callPrivileges == NativeMethods.LINECALLPRIVILEGE_MONITOR ? Privilege.Monitor : Privilege.Owner; foreach (EventHandler<NewCallEventArgs> nc in NewCall.GetInvocationList()) { //nc.BeginInvoke(this, new NewCallEventArgs(call, priv), // delegate (IAsyncResult ar) // { // try // { // var nce = (EventHandler<NewCallEventArgs>)ar.AsyncState; // nce.EndInvoke(ar); // } // catch // { // } // }, nc); await Task.Run(() => { try { nc.Invoke(this, new NewCallEventArgs(call, priv)); } catch { } }); } } }
Sorry, something went wrong.
No branches or pull requests
I can make a call...BUT I get an exception:
Note: the call continues in the background while this exception has stopped execution of the program
Looks like if I want to use .NET Core, I have to change how the async calls are done:
https://devblogs.microsoft.com/dotnet/migrating-delegate-begininvoke-calls-for-net-core/
The fix appears to be relatively simple. Here are the necessary changes:
in TapiManager.cs
Now I no longer get the exception, and the call continues normally. Both the async changes were required, or else the UI would hang.
This fix should be compatible with existing applications, and now it supports .NET Core!
The text was updated successfully, but these errors were encountered: