Error thrown by Visual Studio
For some files, but always for those ones, Visual Studio throws an error:
An exception has been encountered. This may be caused by an extension. You can get more information by examining the file 'C:\Users<USERNAME>\AppData\Roaming\Microsoft\VisualStudio\15.0_221550df\ActivityLog.xml'
This happens only when I double-click on a file under Changes in the TeamExplorer - Changes window. It is a git repository on which I want to show the Diff - window for that specific file.
If I disable your extension there is no error thrown. After re-enabling it, the error re-appears when I double click, but only on specific files.
Maybe for this kind of windows your extension should not do anything, just skip them.
I am using Visual Studio Professional 2017 15.9.5
If I can help you with more details just let me know; uploading the original file(s) may be problematic - but I am willing to do locally all kind of tests :)
Thanks, radusun
I'm not able to reproduce this. Can you look in ActivityLog.xml for a stack trace of the error?
Hello Sam,
I've managed to make a simple solution in which I copied only the troubled file and created locally a git repository. In case you need to extract it in the original path, that was C:\TEMP then comes InheritanceMargin and so on So, in order to reproduce the error, you display the history of master, double click on last change to see the commit details then double click on CrashingFiles.cs to display the differences. The error message box should come immediately.
I've attached the archive of the solution and repository. Also, you can find inside a copy of ActivityLog.xml (link removed)
Note: The error comes only once per Visual Studio session. Apparently it is working then without any problems. But, I've always experienced problems later with Visual Studio after that, which sooner or later will lead to an automatic restart of Visual Studio (because of an internal crash).
Thanks for your quick reply, radusun
System.ArgumentException: The specified ITextSnapshot doesn't belong to the correct TextBuffer.
at Microsoft.VisualStudio.Text.SnapshotSpan.TranslateTo(ITextSnapshot targetSnapshot, SpanTrackingMode spanTrackingMode)
at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__39.MoveNext()
at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<InternalGetTags>d__41.MoveNext()
at Microsoft.VisualStudio.Text.Editor.Implementation.GlyphMargin`1.RefreshGlyphsOver(ITextViewLine textViewLine)
at Microsoft.VisualStudio.Text.Editor.Implementation.GlyphMargin`1.OnLayoutChanged(Object sender, TextViewLayoutChangedEventArgs e)
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)