SpecFlow.VisualStudio
SpecFlow.VisualStudio copied to clipboard
SpecFlow Visual Studio integration hanging Visual Studio waiting on telemetry to be flushed to the network
SpecFlow Version
Unknown
Test Runner Version Number
Unknown
Issue Description
I'm from the Visual Studio performance team and our telemetry is showing that that SpecFlow VS integration is hanging Visual Studio while it sends and flushes telemetry. This is preventing users from interacting with VS while this code is running.
Over the past 21 days, it has had the following impact on Visual Studio:
| Root | Leaf | Expressed Hits | Total Hits | Duration (75th Percentile) | Delayed Mouse Clicks | Delayed Key Strokes |
|---|---|---|---|---|---|---|
| techtalk.specflow.visualstudiointegration.dll!TechTalk.SpecFlow.VsIntegration.SpecFlowPackagePackage.InitializeAsync | microsoft.applicationinsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryTransmitter.DequeueAndSend | 2739 | 4717 | 4.8 sec | 2710 | 32 |
Expressed delays are situations where the UI hung while within this method and it interrupted/prevented users mouse or keyboard input. Total hits are all the times the UI hung while within this method, regardless of whether input was interrupted.
There are many call stacks that trigger this failure however, they all contain the the following frames:
chtalk.specflow.visualstudiointegration.dll!TechTalk.SpecFlow.VsIntegration.SpecFlowPackagePackage.InitializeAsync
-> mscorlib!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start
--> techtalk.specflow.visualstudiointegration.dll!TechTalk.SpecFlow.VsIntegration.SpecFlowPackagePackage+<InitializeAsync>d__.MoveNext
---> techtalk.specflow.ideintegration.dll!TechTalk.SpecFlow.IdeIntegration.Install.InstallServices.OnPackageLoad
----> techtalk.specflow.vsintegration.implementation.dll!TechTalk.SpecFlow.VsIntegration.Implementation.Analytics.AnalyticsTransmitter.TransmitExtensionLoadedEvent
-----> techtalk.specflow.vsintegration.implementation.dll!TechTalk.SpecFlow.VsIntegration.Implementation.Analytics.AnalyticsTransmitter.Execute
------> techtalk.specflow.vsintegration.implementation.dll!TechTalk.SpecFlow.VsIntegration.Implementation.Analytics.AppInsightsAnalyticsTransmitterSink.TransmitEvent
-------> microsoft.applicationinsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryChannel.Flush
--------> microsoft.applicationinsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryTransmitter.Flush
---------> microsoft.applicationinsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryTransmitter.DequeueAndSend
To fix this issue, please avoid Flushing the AppInsights channel on the UI thread and/or blocking on it, for example:
Task.Run(() => channel.Flush()).Forget();
Steps to Reproduce
This data comes our telemetry system, so we do not have any information on the versions of SpecFlow or any dlls involved in this problem. We also have no understanding of the steps involved to reproduce the above situation other than the fact this data was just captured from real world usage.
Link to Repro Project
No response
Thanks for the issue report. We will have a look at it. With the stack trace it should be not that hard to find the issue.
@SabotageAndi We found a bunch more stacks and they all in AppInsightsAnalyticsTransmitterSink.TransmitEvent, so be sure to find all direct and indirect callers of it.