pasztorpisti / vs-window-title-changer

Extension to set the title of the Visual Studio IDE using an expression.
https://visualstudiogallery.msdn.microsoft.com/2e8ebfe4-023f-4c4d-9b7a-d05bbc5cb239
MIT License
16 stars 12 forks source link

Crash bugs #3

Closed pasztorpisti closed 7 years ago

pasztorpisti commented 8 years ago

The last few changes of the plugin were added with haste. The result is some messy code and a set of bugs that cause crashes for some people. It makes things a bit more interesting that the plugin makes use of multithreading, hence the undeterministic nature of the crash. I'm afraid the crashes may have correlation with VS versions too. For some people the plugin causes crash at VS startup, for some others the crash happens only sometimes (I'm almost sure it will be a nasty bug in my multithreaded code.). This may actually be a set of bugs, not just one. Thanks to everyone for the bug reports on the VS gallery page of the plugin (https://visualstudiogallery.msdn.microsoft.com/2e8ebfe4-023f-4c4d-9b7a-d05bbc5cb239/):

Reported by MSFT Max B

I'm getting pretty frequent crashes caused by this plugin after updating to VS 2015 Update 1 (VS 2013 was fine).

Is anyone else seeing this?

Exception Info: System.NullReferenceException
   at VSWindowTitleChanger.ExpressionCompilerThread.Run()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

Reported by stavn

I get a hanging VS 2015 if I try to debug a VS extension when this extension is enabled.

Steps to repro: Prerequisite: Visual Studio Extensibility tools installed (you can do that in a later step)

  1. Start VS (referred to as the debugger instance)
  2. Create a new VSIX Project from the C# template
  3. Add a new Custom Command from C# template
  4. Run the project
  5. An experimental debugee VS instance will start
  6. In debugee instance choose Tools|Invoke Command1 -> The debugee instance crashes, and the debugger instance appear frozen until the debugee instance is killed.

Disabling this extension removes the problem

If you have trouble reproducing this I will happily provide you with more info.

Reported by Andre.Ziegler

While playing with some texts (possible some invalid ones), I got a VS2012 crash. I see from the dmp that I got a System.NullReferenceException in VSWindowTitleChanger.ExpressionCompilerThread.Run:

0:039> !pe 2b88a618
Exception object: 2b88a618
Exception type:   System.NullReferenceException
Message:          Object reference not set to an instance of an object.
InnerException:   <none>
StackTrace (generated):
    SP       IP       Function
    2CF7F194 224DB831 UNKNOWN!VSWindowTitleChanger.ExpressionCompilerThread.Run()+0x71
    2CF7F1C8 60D1929B mscorlib_ni!System.Threading.ThreadHelper.ThreadStart_Context(System.Object)+0x6f
    2CF7F1D4 60D11487 mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+0xa7
    2CF7F240 60D113C6 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+0x16
    2CF7F254 60D11381 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x41
    2CF7F26C 60D1921C mscorlib_ni!System.Threading.ThreadHelper.ThreadStart()+0x44

StackTraceString: <none>
HResult: 80004003

I get new crashes since today:

MANAGED_STACK: 
   at Microsoft.VisualStudio.Platform.WindowManagement.DTE.MainWindow..ctor(WindowBase wrapper, Window window)
   at Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase.CreateMainWindow()
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.get_MainWindow(Window& mainWindow)

EXCEPTION_OBJECT: !pe 10111e60
Exception object: 10111e60
Exception type:   System.Reflection.TargetInvocationException
Message:          Exception has been thrown by the target of an invocation.
InnerException:   System.NullReferenceException, Use !PrintException 10110424 to see more.
StackTrace (generated):
    SP       IP       Function
    00000000 00000001 mscorlib_ni!System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)+0x2
    00AEDBFC 5F6B94B1 mscorlib_ni!System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])+0xc1
    00AEDC20 5F6D0AA7 mscorlib_ni!System.Reflection.RuntimeMethodInfo.UnsafeInvoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)+0x67
    00AEDC4C 5F6D0F51 mscorlib_ni!System.Delegate.DynamicInvokeImpl(System.Object[])+0x69
    00AEDC60 5DC46063 System_Windows_Forms_ni!System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)+0xaf
    00AEDC7C 5DC45F7B System_Windows_Forms_ni!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)+0x63
    00AEDCA4 5F6DD987 mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+0xa7
    00AEDD10 5F6DD8D6 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+0x16
    00AEDD24 5F6DD8A1 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Th

here is the complete output of the dmp:

http://pastebin.com/WkC4Ygga

max630 commented 8 years ago

I experience similar crash. Stack is same as reported by MSFT Max B, but the actual exception is "Access violation" from some native code (!!). Happens when I reload solution after git reset --hard. I used to have shell exec in the title - to get the git branch name. After I removed the exec call it seems to not crash anymore.

Windows 7 sp1, VS 2015 update 1

pasztorpisti commented 7 years ago

A serious/trivial multithreading crash bug (that usually happened in VSWindowTitleChanger.ExpressionCompilerThread.Run()) has been fixed by a9e2c1ba10b4a340cd02feedd7f605c845aa90d2 in v2.1.9. This is very likely to resolve the problems experienced by MSFT Max B, Andre.Ziegler and @max630.

The bug reported by stavn has since been reported by others and moved to issue #12.