I have quite some experience in debugging memory dumps, so now that I have a C# problem, I try to solve this using memory dump analysis too, but this seems not to work:
When I use my user-interactive application, I get a System.ArgumentNullException: Value cannot be null. Parameter name: name.
When I see this in my Visual Studio environment, or when I debug the memory dump I've taken at that moment, these are the first lines of the call stack:
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,
Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
...
However, when I click Copy Details, I see quite a lot more, as you can see:
at Application.Client.Desktop.Controls.UserAuthentication.OnUserLogOn(User user)
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)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
...
So, the problem is somewhere in the OnUserLogon() function, who is working with the user input variable, and I can only imagine how interesting the knowledge of this variable might be :-)
But as my call stack does not go that deep, I don't have access to that variable.
One thing which might be important: while trying to debug, I see "Symbol loading skipped", and I can confirm that I have two symbol sources:
- Microsoft Symbol Servers
- Some company-owned website
In order to see a full C# call stack, do I need to add more symbol sources or is there any other thing I should do?
For your information, when debugging the memory dump, I have already tried Debug with Managed Only and Debug with Mixed, none of those possibilities solved my issue.
Thanks in advance
Edit after first comment
Apparently there might be some unexpectedly interesting information in the call stack, so hereby I show the entire call stack as shown in Visual Studio Call Stack window:
> WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Unknown
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj) 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!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext 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, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) 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.Delegate callback, object args, int numArgs, System.Delegate catchHandler) 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, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Unknown
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Unknown
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Unknown
MyApplication.Desktop.exe!MyApplication.Client.Desktop.App.Main() Unknown
Does this give any more information? (Like the thread where the actual problem happens? Please be aware that quite some information has been optimised away and I can't re-compile the application: I'm only allowed to work on a DLL, being used by that application)
Edit2: added more information
While doing the test a new time, I have seen following call stack in a so-called Worker Thread:
mscorlib.dll!System.Diagnostics.StackFrameHelper.InitializeSourceInfo(int iSkip, bool fNeedFileInfo, System.Exception exception) Line 109 C#
mscorlib.dll!System.Diagnostics.StackTrace.CaptureStackTrace(int iSkip, bool fNeedFileInfo, System.Threading.Thread targetThread, System.Exception e) Line 523 C#
mscorlib.dll!System.Diagnostics.StackTrace.StackTrace(System.Exception e, bool fNeedFileInfo) Line 407 C#
> mscorlib.dll!System.Environment.GetStackTrace(System.Exception e, bool needFileInfo) Line 1264 C#
mscorlib.dll!System.Exception.GetStackTrace(bool needFileInfo) Line 354 C#
mscorlib.dll!System.Exception.ToString(bool needFileLineInfo, bool needMessage) Line 450 C#
NLog.dll!NLog.LayoutRenderers.ExceptionLayoutRenderer.AppendToString(System.Text.StringBuilder sb, System.Exception ex) Unknown
NLog.dll!NLog.LayoutRenderers.ExceptionLayoutRenderer.AppendException(System.Exception currentException, System.Collections.Generic.IEnumerable<NLog.Config.ExceptionRenderingFormat> renderFormats, System.Text.StringBuilder builder) Unknown
NLog.dll!NLog.LayoutRenderers.ExceptionLayoutRenderer.Append(System.Text.StringBuilder builder, NLog.LogEventInfo logEvent) Unknown
NLog.dll!NLog.LayoutRenderers.LayoutRenderer.RenderAppendBuilder(NLog.LogEventInfo logEvent, System.Text.StringBuilder builder) Unknown
NLog.dll!NLog.Layouts.SimpleLayout.RenderAllRenderers(NLog.LogEventInfo logEvent, System.Text.StringBuilder target) Unknown
NLog.dll!NLog.Layouts.Layout.RenderAllocateBuilder(NLog.LogEventInfo logEvent, System.Text.StringBuilder reusableBuilder) Unknown
NLog.dll!NLog.Layouts.Layout.Render(NLog.LogEventInfo logEvent) Unknown
NLog.dll!NLog.LayoutRenderers.Wrappers.OnExceptionLayoutRendererWrapper.RenderInner(NLog.LogEventInfo logEvent) Unknown
NLog.dll!NLog.LayoutRenderers.Wrappers.WrapperLayoutRendererBase.Append(System.Text.StringBuilder builder, NLog.LogEventInfo logEvent) Unknown
NLog.dll!NLog.LayoutRenderers.LayoutRenderer.RenderAppendBuilder(NLog.LogEventInfo logEvent, System.Text.StringBuilder builder) Unknown
NLog.dll!NLog.Layouts.SimpleLayout.RenderAllRenderers(NLog.LogEventInfo logEvent, System.Text.StringBuilder target) Unknown
NLog.dll!NLog.Layouts.Layout.RenderAppendBuilder(NLog.LogEventInfo logEvent, System.Text.StringBuilder target, bool cacheLayoutResult) Unknown
NLog.dll!NLog.Targets.FileTarget.RenderFormattedMessageToStream(NLog.LogEventInfo logEvent, System.Text.StringBuilder formatBuilder, char[] transformBuffer, System.IO.MemoryStream streamTarget) Unknown
NLog.dll!NLog.Targets.FileTarget.Write(System.Collections.Generic.IList<NLog.Common.AsyncLogEventInfo> logEvents) Unknown
NLog.dll!NLog.Targets.Target.WriteAsyncThreadSafe(System.Collections.Generic.IList<NLog.Common.AsyncLogEventInfo> logEvents) Unknown
NLog.dll!NLog.Targets.Target.WriteAsyncLogEvents(System.Collections.Generic.IList<NLog.Common.AsyncLogEventInfo> logEvents) Unknown
NLog.dll!NLog.Targets.Wrappers.AsyncTargetWrapper.WriteEventsInQueue(int batchSize, string reason) Unknown
NLog.dll!NLog.Targets.Wrappers.AsyncTargetWrapper.ProcessPendingEvents(object state) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980 C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928 C#
mscorlib.dll!System.Threading.TimerQueueTimer.CallCallback() Line 713 C#
mscorlib.dll!System.Threading.TimerQueueTimer.Fire() Line 670 C#
mscorlib.dll!System.Threading.TimerQueue.FireNextTimers() Line 425 C#
Unfortunately almost every object is optimised away, so I can't give more information.