Sharpcap crashes

A place to report problems and bugs in SharpCap
Forum rules
‍

If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs

Please also read about Troubleshooting USB Issues before posting.

*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***

Please include the following details in any bug report:

* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
Post Reply
astra
Posts: 41
Joined: Fri May 24, 2024 12:29 pm

Sharpcap crashes

#1

Post by astra »

I have an issue starting Sharpcap. Versions affected for al least a year including latest. Camera Apollo M, clean install, reinstall, rollback to previous version doesn't help
Symptoms:
1. When I launch sharpcap it can immediately crash, I can see ins tatusbar "detecting cameras". I try to start sharpcap for 10-15 times(!) and then
2. Sharpcap restores default settings for camera and starts without connecting to camera. When i click connect to camera, it crashes. The loops continues
3. After some magic tries I can appear in the state of sharpcap starts, but not connects. At this point I connect to test highspeed camera. And after that I can connect to Apollo 174

I have tried everything possible solutions and I believe it is sharpcap issue. After a crash I can successfully connect and open camera in firecapture without any issues. Even after that sharpcap fails to connect. Only connecting to test camera helps, or by some occasion without this step I can connect to it(but this is very rare)

Code: Select all

Info   	00:00:06.421000	#1 	Loading Hardware Proxies from SharpCap.ScintillationMonitor.ScintillationMonitorFactory									in void SharpCap.ProxyFinder<T>.LoadProxiesForFactoryType(Type t)
Info   	00:00:06.421000	#1 	Found device SSM3 Scintillation Monitor																					in void SharpCap.ProxyFinder<T>.LoadProxiesForFactoryType(Type t)
Info   	00:00:06.421000	#1 	Found device AiryLab SSM																								in void SharpCap.ProxyFinder<T>.LoadProxiesForFactoryType(Type t)
Warning	00:00:06.531000	#18	AppDomain Unhandled exception event recevied for System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart(), Terminating=True			in void SharpCap.BugReporting.CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
Warning	00:00:06.546000	#18	Starting error processing on : Exception of type 'NullReferenceException' : Object reference not set to an instance of an object. 
Stack Trace:   at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>+AsyncStateMachineBox<TStateMachine>.MoveNext(Thread threadPoolThread) x 2
   at void System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, bool allowInlining)
   at void System.Threading.Tasks.Task.ThrowAsync(Exception exception, SynchronizationContext targetContext)+(object state) => { }
   at void System.Threading.QueueUserWorkItemCallback.Execute()
   at bool System.Threading.ThreadPoolWorkQueue.Dispatch()
   at void System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()				in bool SharpCap.BugReporting.ShouldReportException(Exception exception)
Info   	00:00:06.546000	#18	Considering if the error needs to be reported : System.NullReferenceException("Object reference not set to an instance of an object.")				in bool SharpCap.BugReporting.WorkOutIfWeShouldReport(Exception exception)
Warning	00:00:06.562000	#11	AppDomain Unhandled exception event recevied for System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart(), Terminating=True			in void SharpCap.BugReporting.CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
Warning	00:00:06.562000	#11	Starting error processing on : Exception of type 'NullReferenceException' : Object reference not set to an instance of an object. 
Stack Trace:   at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>+AsyncStateMachineBox<TStateMachine>.MoveNext(Thread threadPoolThread) x 2
   at void System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, bool allowInlining)
   at void System.Threading.Tasks.Task.ThrowAsync(Exception exception, SynchronizationContext targetContext)+(object state) => { }
   at void System.Threading.QueueUserWorkItemCallback.Execute()
   at bool System.Threading.ThreadPoolWorkQueue.Dispatch()
   at void System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()				in bool SharpCap.BugReporting.ShouldReportException(Exception exception)
Info   	00:00:06.562000	#18	Checking to see if error 'Object reference not set to an instance of an object.' is caused by ASCOM drivers or other third party code.				in bool SharpCap.NonReportableExceptions.HandleThirdPartyException(Exception e, IApplication app)
Info   	00:00:06.562000	#1 	SharpCap startup complete in 6102ms																						in void SharpCap.UI.MainWindowSupport.OnShown(IWindowOrForm parentWindow, IImageDisplay displayTarget, INightMode nightMode)
Info   	00:00:06.578000	#18	Error needs to be reported : 'Object reference not set to an instance of an object.' of type System.NullReferenceException at    at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>+AsyncStateMachineBox<TStateMachine>.MoveNext(Thread threadPoolThread) x 2     at void System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, bool allowInlining)     at void System.Threading.Tasks.Task.ThrowAsync(Exception exception, SynchronizationContext targetContext)+(object state) => { }     at void System.Threading.QueueUserWorkItemCallback.Execute()     at bool System.Threading.ThreadPoolWorkQueue.Dispatch()     at void System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()				in bool SharpCap.BugReporting.ShouldReportException(Exception exception)
Info   	00:00:06.578000	#11	We have already flagged an error to be reported, not going to report System.NullReferenceException("Object reference not set to an instance of an object.")				in bool SharpCap.BugReporting.WorkOutIfWeShouldReport(Exception exception)
Info   	00:00:06.578000	#11	Error to be ignored, not reported : 'Object reference not set to an instance of an object.' of type System.NullReferenceException at    at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>+AsyncStateMachineBox<TStateMachine>.MoveNext(Thread threadPoolThread) x 2     at void System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, bool allowInlining)     at void System.Threading.Tasks.Task.ThrowAsync(Exception exception, SynchronizationContext targetContext)+(object state) => { }     at void System.Threading.QueueUserWorkItemCallback.Execute()     at bool System.Threading.ThreadPoolWorkQueue.Dispatch()     at void System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()					in bool SharpCap.BugReporting.ShouldReportException(Exception exception)
Info   	00:00:06.578000	#18	Invoking emergency handler Finish any active capture with timeout of 10s												in void SharpCap.Base.Utilities.EmergencyHub.OnEmergencyEvent(Exception ex)
Info   	00:00:06.593000	#18	Emergency handler Finish any active capture completed																	in void SharpCap.Base.Utilities.EmergencyHub.OnEmergencyEvent(Exception ex)
Warning	00:00:06.593000	#18	Exception Preprocessing on System.NullReferenceException 'Object reference not set to an instance of an object.' : Exception of type 'NullReferenceException' : Object reference not set to an instance of an object. 
Stack Trace:   at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>+AsyncStateMachineBox<TStateMachine>.MoveNext(Thread threadPoolThread) x 2
   at void System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, bool allowInlining)
   at void System.Threading.Tasks.Task.ThrowAsync(Exception exception, SynchronizationContext targetContext)+(object state) => { }
   at void System.Threading.QueueUserWorkItemCallback.Execute()
   at bool System.Threading.ThreadPoolWorkQueue.Dispatch()
   at void System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()			in Exception SharpCap.BugReporting.PreprocessException(Exception arg)
Info   	00:00:06.609000	#1 	Opening default/previous camera on startup.																				in async Task SharpCap.UI.MainWindowSupport.OnFirstTickAsync()
Warning	00:00:06.609000	#18	Creating bug report due to exception :  : Exception of type 'NullReferenceException' : Object reference not set to an instance of an object. ()					in void SharpCap.BugReporting.SettingsOnProcessingException(Exception arg1, Report report)
Info   	00:00:06.625000	#1 	Changing camera from none to Apollo-M (IMX174)																			in void SharpCap.Models.Application.SelectNewCamera(Camera value)
Info   	00:00:06.734000	#1 	Plate solver detection : Manually configured Astrometry - Not configured												in bool SharpCap.ImageProcessing.PlateSolving.CombinedPlateSolveFactory.CheckInstalledImpl()
Info   	00:00:06.750000	#1 	Plate solver detection : AstroTortilla - Not detected																	in bool SharpCap.ImageProcessing.PlateSolving.CombinedPlateSolveFactory.CheckInstalledImpl()
Info   	00:00:06.750000	#1 	Plate solver detection : All Sky Plate Solver - Not found at C:\Users\station\AppData\Local\Astrometry					in bool SharpCap.ImageProcessing.PlateSolving.CombinedPlateSolveFactory.CheckInstalledImpl()
Info   	00:00:06.750000	#1 	Plate solver detection : Ansvr - Not found at C:\Users\station\AppData\Local\cygwin_ansvr								in bool SharpCap.ImageProcessing.PlateSolving.CombinedPlateSolveFactory.CheckInstalledImpl()
Info   	00:00:06.750000	#1 	Plate solver detection : Cygwin/Astrometry based - Not found at C:\cygwin												in bool SharpCap.ImageProcessing.PlateSolving.CombinedPlateSolveFactory.CheckInstalledImpl()
Info   	00:00:06.750000	#1 	Plate solver detection : Astap (manual location) - Not configured														in bool SharpCap.ImageProcessing.PlateSolving.CombinedPlateSolveFactory.CheckInstalledImpl()
Info   	00:00:06.750000	#1 	Astap found at c:\Program Files\Astap\Astap.exe																			in bool SharpCap.ImageProcessing.PlateSolving.AstapPlateSolverFactoryBase.CheckInstalledImpl()
Info   	00:00:06.750000	#1 	Plate solver detection : Astap (auto-detect) - Found at c:\Program Files\Astap\Astap.exe								in bool SharpCap.ImageProcessing.PlateSolving.CombinedPlateSolveFactory.CheckInstalledImpl()
Warning	00:00:06.765000	#18	Assembly Microsoft.GeneratedCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null loaded more than once			in void SharpCap.Program.CurrentDomainOnAssemblyLoad(object sender, AssemblyLoadEventArgs assemblyLoadEventArgs)+(string _, Assembly a) => { } [1]
Info   	00:00:06.781000	#1 	Capture Event : OpeningDevice																							in void SharpCap.MultiCaptureProvider.SendCaptureEvent(object sender, CaptureEventArgs e)
Info   	00:00:06.781000	#1 	OpeningDevice event received in UI thread																				in async void SharpCap.ViewModels.SharpCapViewModel.appModel_OnCaptureEvent(object sender, CaptureEventArgs e)
Debug  	00:00:06.796000	#1 	Opening device : Apollo-M (IMX174) (via Player One Cameras)																in void SharpCap.MultiCaptureProvider.OpenDevice(DeviceTagData deviceTag, ISensorDataProvider sensorDataProvider)
Debug  	00:00:06.796000	#1 	Started void SharpCap.Base.CaptureProviderBase<T>.Initialize(IImageDisplay previewTargetWindow, ISensorDataProvider sensorDataProvider)				in void SharpCap.Base.CaptureProviderBase<T>.Initialize(IImageDisplay previewTargetWindow, ISensorDataProvider sensorDataProvider)
Debug  	00:00:06.796000	#1 	Ended void SharpCap.Base.CaptureProviderBase<T>.Initialize(IImageDisplay previewTargetWindow, ISensorDataProvider sensorDataProvider)					in void SharpCap.Base.CaptureProviderBase<T>.Initialize(IImageDisplay previewTargetWindow, ISensorDataProvider sensorDataProvider)
Info   	00:00:06.828000	#1 	Started void SharpCap.Base.CaptureProviderBase<T>.OpenDevice(DeviceTagData dtd)											in void SharpCap.Base.CaptureProviderBase<T>.OpenDevice(DeviceTagData dtd)
Debug  	00:00:06.828000	#1 	Started void SharpCap.Base.SimpleCaptureProvider.SetupDevice(DeviceTagData dtd)											in void SharpCap.Base.SimpleCaptureProvider.SetupDevice(DeviceTagData dtd)
Info   	00:00:06.859000	#1 	Opening P1 Camera Apollo-M (IMX174) #0 on \\?\usb#vid_a0a0&pid_1741#5&14013d94&0&10#{5888d653-2297-f1dd-d39c-356271cec3b9}					in new SharpCap.Cameras.P1.P1CameraProxy(DeviceTagData dtd)
Debug  	00:00:06.875000	#18	Attempting to dump diagnostic thread state																				in string[] SharpCap.Base.ThreadDumper.GetThreadStacks()
Info   	13:08:47.006667	#22	=='.NET TP Worker' (New Thread)
- end of log
astra
Posts: 41
Joined: Fri May 24, 2024 12:29 pm

Re: Sharpcap crashes

#2

Post by astra »

Anotehr exception

Code: Select all

	WPF Dispatcher Unhandled exception event recevied for System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at SharpCap.ViewModels.SharpCapViewModel.WindowDisable.Dispose() in C:\Documents\Source Code\SharpCap4.1\src\SharpCap\ViewModels\SharpCapViewModel.cs:line 941
   at SharpCap.UI.MainWindowSupport.OnShown(IWindowOrForm parentWindow, IImageDisplay displayTarget, INightMode nightMode) in C:\Documents\Source Code\SharpCap4.1\src\SharpCap\UI\MainUI\MainWindowSupport.cs:line 347
   at SharpCap.ViewModels.SharpCapViewModel.OnShown(IWindowOrForm parentWindow, INightMode nightMode) in C:\Documents\Source Code\SharpCap4.1\src\SharpCap\ViewModels\SharpCapViewModel.cs:line 861
   at SharpCap.New.MainWindow.<MainWindow_OnLoaded>b__20_0() in C:\Documents\Source Code\SharpCap4.1\src\SharpCap\NewUI\MainWindow.xaml.cs:line 170
   at SharpCap.Base.ExtensionMethods.LogThenRethrow(Object o, Action a) in C:\Documents\Source Code\SharpCap4.1\src\SharpCap.Base\ExtensionMethods.cs:line 781
   at SharpCap.Utils.ExtensionMethods.<>c__DisplayClass11_0.<RunViaDispatcher>b__0() in C:\Documents\Source Code\SharpCap4.1\src\SharpCap\Utils\ExtensionMethods.cs:line 278
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), handled = False				in void SharpCap.BugReporting.CurrentDispatcherOnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
User avatar
admin
Site Admin
Posts: 17524
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Sharpcap crashes

#3

Post by admin »

Hi,

unfortunately it's hard to get a good grip on those errors from only partial logs - I can't see the SharpCap version, information about the system or other information leading up to the problem point. However, I have checked my database of uploaded bug reports, and I can't find any that match the information seen in the logs, telling me these errors must be unusual - possibly unique - to your setup.

Because of this, and the fact that the errors themselves don't seem to make sense in the sense that things shouldn't break in the indicated ways at the indcated points, I start wondering about things like hardware stability, graphics drivers and other installed software... All of these have led to weird and strange errors being reported in the past, including

* the sum of values in the histogram did not match the total number of pixels in the image - always off by a power of 2 - caused by memory issues
* Crashes at strange places caused by UI automation or UI accessibility software with bugs in
* Crashes caused by antivirus software intruding into SharpCap's code - particularly 'free but we want to sell you the paid version' tools like Avast etc.
* Crashes caused by buggy graphics drivers
* Crashes caused by buggy AV codecs installed by other software (usually this only hits webcams)

It would certainly be worth testing to see if any of these are relevant - upgrade graphics drivers from the graphics chip manufacturers website (ie Intel/AMD/Nvidia - not Dell/HP/etc as they may be older versions); disable antivirus temporarily, especially if not 'Microsoft Defender'; think if any UI automation or accessibility software is installed. Also please test with the very latest version and either submit the bug reports using the 'Send and Quit' button in the bug reporting or post the full log for me to dig into.

cheers,

Robin
astra
Posts: 41
Joined: Fri May 24, 2024 12:29 pm

Re: Sharpcap crashes

#4

Post by astra »

If I see a stacktrace it is usually enough for me to fix a bug in my code.

But anyway. I eliminated a set of crashes myself. The issue was due to loading Basler camera drivers. After deleting SharpCap.Cameras.Basler.dll I reduced 40% crashes. Then removing SharpCap.Cameras.PointGrey.dll fixed another 40% crashes. Adding and removing the files clearly replicates the crashes. If someone asks me whats the cause, I won't name buggy graphics drivers, antivirus, AV codecs etc.
User avatar
admin
Site Admin
Posts: 17524
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Sharpcap crashes

#5

Post by admin »

Hi,

I expect you are on the same track as my suggestion - both of the exception stack traces in your first post were 'nonsense' - exceptions of types that should be impossible coming from the places that they are coming from, so they don't lead to anywhere in the SharpCap code to find the cause of the bug. What that sort of unusual exception does point towards is things like memory corruption, unexpected code injected into the process, bugs in existing or 3rd part code or similar.

I've never encountered that sort of behaviour caused by the Basler or PointGrey camera drivers, but I have seen that sort of thing happen due to other tools running on the PC from security software to assistive technologies like screen readers which all can inject their own code into every process that runs.

Anyway, glad to hear that you have found a solution for your case.

cheers,

Robin
Post Reply