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 from VSWindowTitleChanger.ExpressionCompilerThread.Run() #9

Closed scottbilas closed 7 years ago

scottbilas commented 8 years ago

I've been getting a crash in VS2015 for a while now. Just randomly dies while nothing in particular is going on. Finally decided to look into it with Windbg, which caught it and seems to implicate VSWindowTitleChanger. Below I've pasted what windbg reports before VS's crash handler kicks in and starts trying to report to MS.

The problem seems to happen quicker when I have more than one VS at a time loaded. Sometimes the first instance will crash, sometimes later ones.

I'm using the following expression:

anything_dirty
    + (sln_open ?
        // sln
        sln_filename
        // hg?
        + (exec hg_branch 60 "hg branch" sln_dir ?
            " [" + ((exec hg_root 60 "hg root" sln_dir) =~ ".*\\(.*\\.*)$" ? locase $1) + "@"
            + hg_branch
            + "]"
          )
        + (exec git_branch 60 "git rev-parse --abbrev-ref HEAD" sln_dir ?
            " [" + git_branch + "@"
            + ((exec git_root 60 "git rev-parse --show-toplevel" sln_dir) =~ ".*/(.*/.*)$" ? locase $1)
            + "]"
          )
        // config|platform
        + " (" + configuration + "|" + platform + ")"
        // exec mode
        + (debugging ? " {" + debug_mode + "}")
        + " - "
      )
    + "Visual Studio " + (vs_version == "14.0" ? "2015" : "")

And here is the dump from Windbg:

(bfc.26f4): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** ERROR: Module load completed but symbols could not be loaded for C:\WINDOWS\assembly\NativeImages_v4.0.30319_32\mscorlib\40571abae9422cd2ca6fafbbde1c3cdc\mscorlib.ni.dll
eax=00000000 ebx=034e6f64 ecx=2d2c9300 edx=3b322bf4 esi=2d6d611c edi=30aeebd4
eip=2f233c21 esp=30aeebb4 ebp=30aeebe0 iopl=0         nv up ei pl zr na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010246
2f233c21 8b4010          mov     eax,dword ptr [eax+10h] ds:002b:00000010=????????
0:079> g
(bfc.25d0): Unknown exception - code 800706ba (first chance)
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>DefaultDomain</AppDomain><Exception><ExceptionType>System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Object reference not set to an instance of an object.</Message><StackTrace>   at VSWindowTitleChanger.ExpressionCompilerThread.Run()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.NullReferenceException: Object reference not set to an instance of an object.
   at VSWindowTitleChanger.ExpressionCompilerThread.Run()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()</ExceptionString></Exception></TraceRecord>
(bfc.25d0): Unknown exception - code 800706ba (first chance)
(bfc.26f4): Access violation - code c0000005 (!!! second chance !!!)
eax=00000000 ebx=034e6f64 ecx=2d2c9300 edx=3b322bf4 esi=2d6d611c edi=30aeebd4
eip=2f233c21 esp=30aeebb4 ebp=30aeebe0 iopl=0         nv up ei pl zr na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010246
2f233c21 8b4010          mov     eax,dword ptr [eax+10h] ds:002b:00000010=????????
scottbilas commented 8 years ago

I should have checked existing issues first. This is a dup of https://github.com/pasztorpisti/vs-window-title-changer/issues/3 I suppose.

pasztorpisti commented 8 years ago

Thank you for the report. Unfortunately I'm not a windows developer at the moment and don't have the time to set up a windows box to debug and fix the issues related to the extension. It makes use of multithreading that might have a bug somewhere. While most people don't have problems it seems that quite a few developers had a similar crash to yours.

It is very likely that the bug is in the exec expression that you are also using to get the git related info.

pasztorpisti commented 7 years ago

This bug has been fixed as described in #3.