Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Task/thread horror! #12

Open
GregDomjan opened this issue Aug 7, 2017 · 1 comment
Open

Task/thread horror! #12

GregDomjan opened this issue Aug 7, 2017 · 1 comment

Comments

@GregDomjan
Copy link

In OnBackgroundActivated, when this.connection.RequestReceived += OnAppServiceRequestReceived; is run, I would think it's attaching waiting for a message, but it seems to run straight away, seeming synchronous unless await Task.Yield() is added to OnAppServiceRequestReceived. Even so, the configuration is incomplete for several lines where it could potentially? be used while incomplete.

In my experiance so far it means that I get an int parse exception parsing an empty string not having an AppService name in OnAppServiceRequestReceived
this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);

If a re arrange the OnBackgroundActivated code like this, then I get the FullTrustProcessLauncher which does seem to go async, so it still hasn't had a chance to run when OnAppServiceRequestReceived restarts and so the desktopBridgeConnections is incomplete.

                    this.connection = appService.AppServiceConnection;

                    lock (thisLock)
                    {
                        this.connection.AppServiceName = connectionIndex.ToString();
                        connections.Add(connectionIndex, this.connection);
                        appServiceDeferrals.Add(connectionIndex, this.appServiceDeferral);
                        connectionIndex++;
                    }

                    this.connection.RequestReceived += OnAppServiceRequestReceived;
                    this.connection.ServiceClosed += AppServiceConnection_ServiceClosed;
@klm1
Copy link

klm1 commented Jun 28, 2018

Yes, the way the code is written, there are essentially two pathways through the OnBackgroundActivated code: one for communication with Edge (and the extension) and one for communication with the desktop bridge app. Both of these pathways need to complete before requests can be received by OnAppServiceRequestReceived, but currently it's possible for requests to be received after only the first pathway (Edge) is initialized.

There's a Microsoft support case on this very issue, Case number: 118052318244647.

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

No branches or pull requests

2 participants