InvalidOperationException occurs when debugging
See original GitHub issueHello! While debugging, I see the following exceptions logged in Visual Studio upon each Cosmos operation, e.g. ReadItemStreamAsync or others. This seems to be associated with IntelliTrace in VS, because when I disable it, the messages no longer appear in the debug console and the operations are significantly faster (I’m assuming IntelliTrace takes time to process each exception).
This isn’t breaking anything as far as I know, just a nuisance in debugging with the output noise and slowdown involved. Wanted to raise here in case there is a way to address it in the SDK.
Exception:
Exception thrown: 'System.InvalidOperationException' in System.Diagnostics.DiagnosticSource.dll (""Can not stop an Activity that was not started"") Exception thrown: 'System.InvalidOperationException' in System.Diagnostics.DiagnosticSource.dll (""Can not stop an Activity that was not started"")
What IntelliTrace looks like:
To Reproduce Run project that uses the SDK to do operations, and observe the Debug output and IntelliTrace events tab. I’m using all the stream-based methods in the preview SDK.
Expected behavior Ideally, no exceptions.
Environment summary SDK Version: 4.0.0 preview3 (also happened with preview1) OS Version: Windows 10 1909 VS: Visual Studio Enterprise 16.4.2, local Cosmos emulator System.Diagnostics.DiagnosticSource 4.7.0 referenced in project
Thanks, happy to provide additional info as needed.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
It turns out it must have been some setting I changed. After doing Visual Studio’s “Reset all settings” from the Import/Export Settings Wizard, the behavior disappears. My guess is something in the Debug settings, but I’m not sure. Diffing 3000 lines of exported settings XML doesn’t immediately reveal anything. 😃
Anyhow, I’ll mark as closed, sorry to bother!
Thanks for checking into it. I’ve found that the behavior doesn’t happen on VS 2019 preview, only on 16.4.2, same machine. May be something in my VS installation or environment, I’ll have to fiddle more and see if I can isolate.
Regarding cause, I didn’t mean to suggest SDK was causing, only that there was some interaction. It definitely occurs while stepping over the Cosmos SDK method call in debug.