Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty .git directory causes SATT to crash Visual Studio #49

Open
hmemcpy opened this issue Feb 23, 2016 · 1 comment
Open

Empty .git directory causes SATT to crash Visual Studio #49

hmemcpy opened this issue Feb 23, 2016 · 1 comment

Comments

@hmemcpy
Copy link
Contributor

hmemcpy commented Feb 23, 2016

I somehow ended up with a corrupt .git directory (it was missing the refs dir). Upon opening the project, and then attempting to open any .cs file, my VS crashed due to an unhandled exception from Rx:

>   mscorlib.dll!System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Unknown
    System.Reactive.PlatformServices.dll!System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(System.Exception exception = {"The directory name C:\\dev\\NBS\\.git\\refs is invalid."})   Unknown
    System.Reactive.Core.dll!System.Reactive.ExceptionHelpers.Throw(System.Exception exception = {"The directory name C:\\dev\\NBS\\.git\\refs is invalid."})   Unknown
    System.Reactive.Core.dll!System.Reactive.Stubs..cctor.AnonymousMethod__1(System.Exception ex = {"The directory name C:\\dev\\NBS\\.git\\refs is invalid."}) Unknown
    System.Reactive.Core.dll!System.Reactive.AnonymousSafeObserver<string>.OnError(System.Exception error = {"The directory name C:\\dev\\NBS\\.git\\refs is invalid."})    Unknown
    System.Reactive.Core.dll!System.Reactive.ScheduledObserver<string>.Run(object state = null, System.Action<object> recurse = {Method = {System.Reflection.RuntimeMethodInfo}})   Unknown
    System.Reactive.Core.dll!System.Reactive.Concurrency.Scheduler.InvokeRec1.AnonymousMethod__4d(object state1 = null) Unknown
    System.Reactive.Core.dll!System.Reactive.Concurrency.Scheduler.InvokeRec1<object>(System.Reactive.Concurrency.IScheduler scheduler = {System.Reactive.Concurrency.DispatcherScheduler}, System.Reactive.Concurrency.Scheduler.Pair<object, System.Action<object, System.Action<object>>> pair = {System.Reactive.Concurrency.Scheduler.Pair<object, System.Action<object, System.Action<object>>>}) Unknown
    System.Reactive.Windows.Threading.dll!System.Reactive.Concurrency.DispatcherScheduler.Schedule.AnonymousMethod__0() Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler = null)  Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()   Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state)  Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()   Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()  Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)  Unknown
    WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = {System.IntPtr}, int msg = 50024, System.IntPtr wParam = {System.IntPtr}, System.IntPtr lParam = {System.IntPtr}, ref bool handled = false)   Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler = null)  Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)   Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = {System.IntPtr}, int msg = 50024, System.IntPtr wParam = {System.IntPtr}, System.IntPtr lParam = {System.IntPtr})    Unknown

Upon further digging, it seems the problem originates in FilesystemWatchCache, where it attempts to create a FSW over a non-existing dir https://github.com/paulcbetts/SaveAllTheTime/blob/master/SaveAllTheTime/Models/FilesystemWatchCache.cs#L26

This line ends up throwing, and the exception is not handled.

I "worked around it" locally, by adding an args check in the Register method of FilesystemWatchCache, returning an empty observable instead. What would be a better solution?

@anaisbetts
Copy link
Owner

What would be a better solution?

Don't have empty .git directories!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants