3

I have a .Net 4.0 WPF application which appears to be hanging sometimes (1-2 times per day). The application is all to do with monitoring users activities and so makes use the a number of native calls (e.g. EnumWindows, GetForegroundWindow, GetLastInputInfo etc). The application also makes use of a SQL Server CE 4.0 database to store some of the information in.

I have managed to get crash dumps from 4-5 of these hangs and they are all looking pretty similar but I am still struggling to get to the cause of the issue.

I have included the results of a DebugDiag analysis of the latest crash dump below. A crash dump taken approx 20sec before this showed exactly the same results. From this it looks like there are 2 threads which are causing others to wait on them.

17 - This thread is inserting some data into the CE database. I cannot see any reason why this thread would be hanging.

22 - I have no idea what this thread is doing from the stacktrace.

The application makes quite heavy use of System.Threading.Tasks in several places to kickoff tasks to process various events and hence there can be quite a lot of threads. From some reading it would look like Thread 22 is a LoaderLock issue but I am using standard windows API calls through DllImport and do not have any custom c++ code (which appears to usually cause this issue).

Any advice or pointers would be appreciated as at the moment I'm a bit stuck!

I can't post the full DebugDiag Results as it's too big but here are the parts which appear to be most important:

**Analysis Summary:**

***Warning***

Detected possible blocking or leaked critical section at ntdll!LdrpLoaderLock owned by thread 22 

Impact of this lock
43.59% of threads blocked
(Threads 0 9 17 18 24 25 28 29 30 31 32 33 34 35 36 37 38)
The following functions are trying to enter this critical section
ntdll!LdrGetDllHandleEx+200
ntdll!LdrGetDllHandleByName+38
ntdll!LdrLockLoaderLock+6d
ntdll!LdrGetProcedureAddressEx+42d
ntdll!LdrShutdownThread+72
ntdll!LdrUnloadDll+2b
ntdll!LdrpInitializeThread+8d

The following module(s) are involved with this critical section

C:\Windows\System32\ntdll.dll from Microsoft Corporation

***Warning***

The following threads in are waiting to enter a .NET Lock which thread 17 is currently holding
( 7 8 10 11 13 14 15 16 19 )
23.08% of threads blocked

**Analysis Details:**

***Locked critical section report***
Critical Section    ntdll!LdrpLoaderLock  
Lock State   Locked 
Lock Count   17
Recursion Count   1
Entry Count   0
Contention Count   161
Spin Count   0
Owner Thread   22
Owner Thread System ID   14788


***Threads which appear to be causing hangs***

***Thread 22 - System ID 14788***
Entry point   ntdll!RtlUserThreadStart+1d 
Create time   08/01/2013 12:45:08 
Time spent in user mode   0 Days 00:00:00.00 
Time spent in kernel mode   0 Days 00:00:00.00 

This thread is not fully resolved and may or may not be a problem. Further analysis of these threads may be required.

Function   Source 
ntdll!NtWaitForSingleObject+a    
KERNELBASE!WaitForSingleObjectEx+79    
ShellExtension!CoreWaitForThreadEx+106    
ShellExtension!_COS_CLIENT_OPERATION_CONTROLLER::COSRemoveAutoResumeTrOps+378    
ShellExtension!_COS_CLIENT_OPERATION_CONTROLLER::~_COS_CLIENT_OPERATION_CONTROLLER+45    
ShellExtension!DllInstall+11a5e    
ShellExtension!DllInstall+69f4    
ShellExtension!DllInstall+6b4e    
ntdll!LdrpUnloadDll+27d    
ntdll!LdrUnloadDll+4a    
KERNELBASE!FreeLibrary+1d    
ole32!CClassCache::CDllPathEntry::CFinishObject::Finish+28   d:\w7rtm\com\ole32\com\objact\dllcache.cxx @ 3394 
ole32!CClassCache::CFinishComposite::Finish+46   d:\w7rtm\com\ole32\com\objact\dllcache.cxx @ 3504 
ole32!CClassCache::FreeUnused+db   d:\w7rtm\com\ole32\com\objact\dllcache.cxx @ 5430 
ole32!CoFreeUnusedLibrariesEx+3b   d:\w7rtm\com\ole32\com\objact\dllapi.cxx @ 175 
user32!UserCallWinProc+19f    
user32!DispatchMessageWorker+143    
ole32!CDllHost::STAWorkerLoop+68   d:\w7rtm\com\ole32\com\objact\dllhost.cxx @ 957 
ole32!CDllHost::WorkerThread+d7   d:\w7rtm\com\ole32\com\objact\dllhost.cxx @ 834 
ole32!CRpcThread::WorkerLoop+1e   d:\w7rtm\com\ole32\com\dcomrem\threads.cxx @ 257 
ole32!CRpcThreadCache::RpcWorkerThreadEntry+1a   d:\w7rtm\com\ole32\com\dcomrem\threads.cxx @ 63 
kernel32!BaseThreadInitThunk+d    
ntdll!RtlUserThreadStart+1d 

***Thread 17 - System ID 14164***
Entry point   ntdll!RtlUserThreadStart+1d 
Create time   08/01/2013 12:32:00 
Time spent in user mode   0 Days 00:00:00.936 
Time spent in kernel mode   0 Days 00:00:03.338 

This thread is not fully resolved and may or may not be a problem. Further analysis of these threads may be required.

.NET Call Stack

Function
DomainBoundILStubClass.IL_STUB_PInvoke() 
System.Data.SqlServerCe.SqlCeConnection..ctor() 
System.Data.SqlServerCe.SqlCeProviderFactory.CreateConnection() 
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Initialize(System.Data.Linq.Provider.IDataServices, System.Object) 
System.Data.Linq.DataContext.Init(System.Object, System.Data.Linq.Mapping.MappingSource) 
Company.MyApplication.Application.Bootstrapper+<>c__DisplayClass7.b__5(Microsoft.Practices.Unity.IUnityContainer) 
Microsoft.Practices.Unity.InjectionFactory+<>c__DisplayClass2.<.ctor>b__0(Microsoft.Practices.Unity.IUnityContainer, System.Type, System.String) 
Microsoft.Practices.ObjectBuilder2.FactoryDelegateBuildPlanPolicy.BuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext) 
Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext) 
Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext) 
Microsoft.Practices.Unity.UnityContainer.DoBuildUp(System.Type, System.Object, System.String, System.Collections.Generic.IEnumerable`1) 
Microsoft.Practices.Unity.UnityContainer.DoBuildUp(System.Type, System.String, System.Collections.Generic.IEnumerable`1) 
Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(System.Type, System.String) 
Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[[System.__Canon, mscorlib]]() 
Company.MyApplication.Application.Services.Timers.PersistedTimerService.AddIdlePeriod(System.DateTime, System.DateTime) 
System.EventHandler`1[[System.__Canon, mscorlib]].Invoke(System.Object, System.__Canon) 
Company.MyApplication.Application.IdleDetection.SystemIdleDetector.CheckSystemState(Int32, Boolean, System.DateTime) 
Company.MyApplication.Application.IdleDetection.SystemIdleDetector+<>c__DisplayClass3.b__1(System.Object, System.Timers.ElapsedEventArgs) 
System.Timers.Timer.MyTimerCallback(System.Object) 
System.Threading.ExecutionContext.runTryCode(System.Object) 
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object) 
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
System.Threading._TimerCallback.PerformTimerCallback(System.Object) 


Full Call Stack

Function   Source 
ntdll!NtWaitForSingleObject+a    
ntdll!RtlpWaitOnCriticalSection+e8    
ntdll!RtlEnterCriticalSection+d1    
ntdll!LdrLockLoaderLock+6d    
KERNELBASE!GetModuleFileNameW+96    
sqlceme40!LoadResourceDll+1d3    
sqlceme40!InitResourceDll+2b    
sqlceme40!DllAddRef+1f    
clr!DoNDirectCall__PatchGetThreadCall+7b    
0x000007ff`001e81fa    
0x000007ff`001e4b6d    
0x000007ff`0048326c    
System_Data_Linq_ni+1fca99    
System_Data_Linq_ni+1653d1    
0x000007ff`00481a08    
0x000007ff`001c4a7f    
0x000007ff`001c4937    
0x000007ff`001b8650    
0x000007ff`001b7c31    
0x000007ff`001b7428    
0x000007ff`001b7244    
0x000007ff`001d74e6    
0x000007ff`001d745b    
0x000007ff`004933d9    
0x000007ff`0004bea9    
0x000007ff`0048c620    
0x000007ff`00493068    
System_ni+260561    
mscorlib_ni+382f68    
clr!CallDescrWorker+84    
clr!CallDescrWorkerWithHandler+a9    
clr!MethodDesc::CallDescr+2a1    
clr!ExecuteCodeWithGuaranteedCleanupHelper+152    
clr!ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup+1a5    
mscorlib_ni+371651    
mscorlib_ni+3ecda7    
clr!CallDescrWorker+84    
clr!CallDescrWorkerWithHandler+a9    
clr!DispatchCallDebuggerWrapper+74    
clr!DispatchCallNoEH+7c    
clr!AddTimerCallback_Worker+85    
clr!VirtualCallStubManager::GenerateResolveCacheElem+aa    
clr!FullSegmentIterator+194    
clr!DomainFile::Activate+375    
clr!COMArrayInfo::GetReference+12b    
clr!AddTimerCallbackEx+77    
clr!ThreadpoolMgr::AsyncTimerCallbackCompletion+49    
clr!UnManagedPerAppDomainTPCount::DispatchWorkItem+181    
clr!ThreadpoolMgr::NewWorkerThreadStart+2e5    
clr!ThreadpoolMgr::WorkerThreadStart+3b    
clr!Thread::intermediateThreadProc+7d    
kernel32!BaseThreadInitThunk+d    
ntdll!RtlUserThreadStart+1d 

***Examples of threads waiting on thread 22***

***Thread 0 - System ID 12068***
Entry point   ntdll!RtlUserThreadStart+1d 
Create time   08/01/2013 12:30:17 
Time spent in user mode   0 Days 00:00:08.190 
Time spent in kernel mode   0 Days 00:00:03.026 

This thread is not fully resolved and may or may not be a problem. Further analysis of these threads may be required.

.NET Call Stack

Function 
System.Windows.Forms.UnsafeNativeMethods.GetModuleHandle(System.String) 
DomainBoundILStubClass.IL_STUB_PInvoke(System.String) 
System.Windows.Forms.Application.get_ComCtlSupportsVisualStyles() 
System.Windows.Forms.ProfessionalColorTable.get_ColorTable() 
System.Windows.Forms.ProfessionalColorTable.FromKnownColor(KnownColors) 
System.Windows.Forms.ToolStripProfessionalRenderer.RenderToolStripDropDownBackground(System.Windows.Forms.ToolStripRenderEventArgs) 
System.Windows.Forms.ToolStripProfessionalRenderer.OnRenderToolStripBackground(System.Windows.Forms.ToolStripRenderEventArgs) 
System.Windows.Forms.ToolStrip.OnPaintBackground(System.Windows.Forms.PaintEventArgs) 
System.Windows.Forms.ToolStripDropDownMenu.OnPaintBackground(System.Windows.Forms.PaintEventArgs) 
System.Windows.Forms.Control.PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs, Int16) 
System.Windows.Forms.Control.WmPaint(System.Windows.Forms.Message ByRef) 
System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef) 
System.Windows.Forms.ToolStrip.WndProc(System.Windows.Forms.Message ByRef) 
System.Windows.Forms.ToolStripDropDown.WndProc(System.Windows.Forms.Message ByRef) 
System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr) 
DomainBoundILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64) 
MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) 
DomainBoundILStubClass.IL_STUB_PInvoke(System.Windows.Interop.MSG ByRef) 
System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) 
System.Windows.Application.RunInternal(System.Windows.Window) 
Company.MyApplication.Application.Program.Main() 

Full Call Stack

Function   Source 
ntdll!NtWaitForSingleObject+a    
ntdll!RtlpWaitOnCriticalSection+e8    
ntdll!RtlEnterCriticalSection+d1    
ntdll!LdrGetDllHandleEx+200    
ntdll!LdrGetDllHandle+1c    
KERNELBASE!GetModuleHandleForUnicodeString+26    
KERNELBASE!BasepGetModuleHandleExW+d6    
KERNELBASE!GetModuleHandleW+1e    
clr!DoNDirectCall__PatchGetThreadCall+7b    
System_Windows_Forms_ni+35b406    
System_Windows_Forms_ni+34d9a6    
System_Windows_Forms_ni+3215f9    
System_Windows_Forms_ni+321378    
System_Windows_Forms_ni+c80860    
System_Windows_Forms_ni+ef939b    
System_Windows_Forms_ni+31fb6f    
System_Windows_Forms_ni+a42080    
System_Windows_Forms_ni+347df2    
System_Windows_Forms_ni+34c96f    
System_Windows_Forms_ni+331339    
System_Windows_Forms_ni+31e9dc    
System_Windows_Forms_ni+2c9495    
System_Windows_Forms_ni+330cfc    
System_Windows_Forms_ni+bc1d50    
clr!UMThunkStubAMD64+77    
user32!UserCallWinProcCheckWow+163    
user32!DispatchClientMessage+c3    
user32!_fnDWORD+2d    
ntdll!KiUserCallbackDispatcherContinue    
user32!NtUserDispatchMessage+a    
user32!DispatchMessageWorker+55b    
clr!DoNDirectCall__PatchGetThreadCall+7b    
WindowsBase_ni!?MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen@@20051M1M120N1M08120N <PERF> (WindowsBase_ni+0x1403f0)    
WindowsBase_ni!?MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream..ctor@@200301128L80126509+1a    
PresentationFramework_ni+3886df    
0x000007ff`001b03fa    
clr!CallDescrWorker+84    
clr!CallDescrWorkerWithHandler+a9    
clr!MethodDesc::CallDescr+2a1    
clr!ClassLoader::RunMain+228    
clr!Assembly::ExecuteMainMethod+ac    
clr!SystemDomain::ExecuteMainMethod+452    
clr!ExecuteEXE+43    
clr!CorExeMainInternal+c4    
clr!CorExeMain+15    
mscoreei!CorExeMain+41    
mscoree!CorExeMain_Exported+57    
kernel32!BaseThreadInitThunk+d    
ntdll!RtlUserThreadStart+1d 

***Thread 38 - System ID 15180***
Entry point   ntdll!LdrInitializeThunk+e 
Create time   08/01/2013 13:53:47 
Time spent in user mode   0 Days 00:00:00.00 
Time spent in kernel mode   0 Days 00:00:00.00 

This thread is waiting on critical section ntdll!LdrpLoaderLock which is owned by thread 22

Function   Source 
ntdll!NtWaitForSingleObject+a    
ntdll!RtlpWaitOnCriticalSection+e8    
ntdll!RtlEnterCriticalSection+d1    
ntdll!LdrpInitializeThread+8d    
ntdll!LdrpInitialize+9f    
ntdll!LdrInitializeThunk+e    

***Examples of threads waiting on thread 17***

***Thread 10 - System ID 11748***
Entry point   ntdll!RtlUserThreadStart+1d 
Create time   08/01/2013 12:30:24 
Time spent in user mode   0 Days 00:00:00.951 
Time spent in kernel mode   0 Days 00:00:05.818 

This thread is waiting to enter a .NET Lock which thread 17 is currently holding

.NET Call Stack

Function 
System.Threading.Monitor.Enter(System.Object) 
Company.MyApplication.Application.Services.Timers.PersistedTimerService.AddIdlePeriod(System.DateTime, System.DateTime) 
System.EventHandler`1[[System.__Canon, mscorlib]].Invoke(System.Object, System.__Canon) 
Company.MyApplication.Application.IdleDetection.SystemIdleDetector.CheckSystemState(Int32, Boolean, System.DateTime) 
Company.MyApplication.Application.IdleDetection.SystemIdleDetector+<>c__DisplayClass3.b__1(System.Object, System.Timers.ElapsedEventArgs) 
System.Timers.Timer.MyTimerCallback(System.Object) 
System.Threading.ExecutionContext.runTryCode(System.Object) 
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object) 
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
System.Threading._TimerCallback.PerformTimerCallback(System.Object) 

Full Call Stack

Function   Source 
ntdll!NtWaitForMultipleObjects+a    
KERNELBASE!WaitForMultipleObjectsEx+e8    
kernel32!WaitForMultipleObjectsExImplementation+b3    
clr!WaitForMultipleObjectsEx_SO_TOLERANT+91    
clr!Thread::DoAppropriateAptStateWait+56    
clr!Thread::DoAppropriateWaitWorker+1b1    
clr!Thread::DoAppropriateWait+73    
clr!CLREvent::WaitEx+c1    
clr!AwareLock::EnterEpilogHelper+ca    
clr!AwareLock::EnterEpilog+63    
clr!AwareLock::Contention+219    
clr!JITutil_MonContention+104    
0x000007ff`004932f8    
0x000007ff`0004bea9    
0x000007ff`0048c620    
0x000007ff`00493068    
System_ni+260561    
mscorlib_ni+382f68    
clr!CallDescrWorker+84    
clr!CallDescrWorkerWithHandler+a9    
clr!MethodDesc::CallDescr+2a1    
clr!ExecuteCodeWithGuaranteedCleanupHelper+152    
clr!ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup+1a5    
mscorlib_ni+371651    
mscorlib_ni+3ecda7    
clr!CallDescrWorker+84    
clr!CallDescrWorkerWithHandler+a9    
clr!DispatchCallDebuggerWrapper+74    
clr!DispatchCallNoEH+7c    
clr!AddTimerCallback_Worker+85    
clr!VirtualCallStubManager::GenerateResolveCacheElem+aa    
clr!FullSegmentIterator+194    
clr!DomainFile::Activate+375    
clr!COMArrayInfo::GetReference+12b    
clr!AddTimerCallbackEx+77    
clr!ThreadpoolMgr::AsyncTimerCallbackCompletion+49    
clr!UnManagedPerAppDomainTPCount::DispatchWorkItem+181    
clr!ThreadpoolMgr::NewWorkerThreadStart+2e5    
clr!ThreadpoolMgr::WorkerThreadStart+3b    
clr!Thread::intermediateThreadProc+7d    
kernel32!BaseThreadInitThunk+d    
ntdll!RtlUserThreadStart+1d

Thread 15 - System ID 8644
Entry point   ntdll!RtlUserThreadStart+1d 
Create time   08/01/2013 12:31:54 
Time spent in user mode   0 Days 00:00:00.686 
Time spent in kernel mode   0 Days 00:00:03.338 

This thread is waiting to enter a .NET Lock which thread 17 is currently holding

.NET Call Stack

Function 
System.Threading.Monitor.Enter(System.Object) 
Company.MyApplication.Application.Services.Timers.PersistedTimerService.PauseTimer(Company.MyApplication.Services.DataContracts.Timing.ITimerIdentifier, Company.MyApplication.Services.DateTimeWithZone) 
Company.MyApplication.Application.Services.Timing.TimerActivityMonitor.CallEndActionIfNoFurtherActivity(Company.MyApplication.Services.DataContracts.Timing.ITimerIdentifier, Company.MyApplication.Services.DateTimeWithZone, System.Action`1, Company.MyApplication.Services.DataContracts.TimeEntrySubmissions.ITimeEntrySubmission) 
Company.MyApplication.Application.Services.Timing.TimerActivityMonitor.RunEndAction(Company.MyApplication.Services.DataContracts.Timing.ITimerIdentifier, Company.MyApplication.Services.DateTimeWithZone, System.Action`1, System.Timers.Timer, Company.MyApplication.Services.DataContracts.TimeEntrySubmissions.ITimeEntrySubmission) 
Company.MyApplication.Application.Services.Timing.TimerActivityMonitor.RegisterTimerEndAction(Company.MyApplication.Services.DataContracts.Timing.ITimerIdentifier, Company.MyApplication.Services.DateTimeWithZone, System.Action`1, System.TimeSpan, Company.MyApplication.Services.DataContracts.TimeEntrySubmissions.ITimeEntrySubmission) 
Company.MyApplication.Application.Services.Timing.EventDrivenTimingService`1[[Company.MyApplication.Services.EventTypes.ApplicationEventType, Company.MyApplication.Services]].PauseTiming(Company.MyApplication.Services.DataContracts.Timing.ITimerIdentifier, Company.MyApplication.Services.DateTimeWithZone, System.TimeSpan, Company.MyApplication.Services.DataContracts.TimeEntrySubmissions.ITimeEntrySubmission) 
Company.MyApplication.Application.Services.Timing.EventDrivenTimingService`1[[Company.MyApplication.Services.EventTypes.ApplicationEventType, Company.MyApplication.Services]].PerformItemAction(Company.MyApplication.Services.DataContracts.Timing.ITimerIdentifier, Company.MyApplication.Services.DateTimeWithZone, Company.MyApplication.Application.Services.Timing.TimerAction, System.TimeSpan, Company.MyApplication.Services.DataContracts.TimeEntrySubmissions.ITimeEntrySubmission) 
Company.MyApplication.Application.Services.Timing.EventDrivenTimingService`1+<>c__DisplayClass3[[Company.MyApplication.Services.EventTypes.ApplicationEventType, Company.MyApplication.Services]].b__0() 
System.Threading.Tasks.Task.Execute() 
System.Threading.ExecutionContext.runTryCode(System.Object) 
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object) 
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef) 
System.Threading.Tasks.Task.ExecuteEntry(Boolean) 
Company.MyApplication.Tools.Tasks.LimitedConcurrencyLevelTaskScheduler.b__3(System.Object) 
System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 
System.Threading.ThreadPoolWorkQueue.Dispatch() 
System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() 

Full Call Stack

Function   Source 
ntdll!NtWaitForMultipleObjects+a    
KERNELBASE!WaitForMultipleObjectsEx+e8    
kernel32!WaitForMultipleObjectsExImplementation+b3    
clr!WaitForMultipleObjectsEx_SO_TOLERANT+91    
clr!Thread::DoAppropriateAptStateWait+56    
clr!Thread::DoAppropriateWaitWorker+1b1    
clr!Thread::DoAppropriateWait+73    
clr!CLREvent::WaitEx+c1    
clr!AwareLock::EnterEpilogHelper+ca    
clr!AwareLock::EnterEpilog+63    
clr!AwareLock::Contention+219    
clr!JITutil_MonContention+104    
0x000007ff`0049414b    
0x000007ff`0049401d    
0x000007ff`00493e13    
0x000007ff`00493c99    
0x000007ff`00493b87    
0x000007ff`004905f9    
0x000007ff`0049046d    
mscorlib_ni+abde22    
mscorlib_ni+382f68    
clr!CallDescrWorker+84    
clr!CallDescrWorkerWithHandler+a9    
clr!MethodDesc::CallDescr+2a1    
clr!ExecuteCodeWithGuaranteedCleanupHelper+152    
clr!ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup+1a5    
mscorlib_ni+371651    
mscorlib_ni+ab8685    
mscorlib_ni+ab8480    
0x000007ff`004902e1    
mscorlib_ni+3bc183    
mscorlib_ni+3bb813    
mscorlib_ni+3bb665    
clr!CallDescrWorker+84    
clr!CallDescrWorkerWithHandler+a9    
clr!MethodDesc::CallDescr+2a1    
clr!MethodDescCallSite::Call+35    
clr!QueueUserWorkItemManagedCallback+44    
clr!VirtualCallStubManager::GenerateResolveCacheElem+aa    
clr!FullSegmentIterator+194    
clr!DomainFile::Activate+375    
clr!ManagedPerAppDomainTPCount::DispatchWorkItem+e6    
clr!ThreadpoolMgr::NewWorkerThreadStart+2e5    
clr!ThreadpoolMgr::WorkerThreadStart+3b    
clr!Thread::intermediateThreadProc+7d    
kernel32!BaseThreadInitThunk+d    
ntdll!RtlUserThreadStart+1d 
cnash
  • 51
  • 3
  • 1
    We need code from your project. Are you doing all your work on the UI thread? – Botonomous Jan 08 '13 at 15:18
  • Thread 22 is the problem - Thread 17 is blocked because of it. – Daniel Hilgarth Jan 08 '13 at 15:20
  • The project is currently at around 180,000 lines of code so clearly I can't post it all. If there are specific methods from the stack traces you think would help then I would be happy to post them. As you can see from the diagnostics there are many threads to clearly I am not doing everything on the UI thread. – cnash Jan 08 '13 at 15:22
  • Thanks Daniel. Not quite sure how I missed that! Any idea how I might figure out what is causing Thread 22 to hang? – cnash Jan 08 '13 at 15:24
  • @user1958459: Hm, hard to tell. It looks like it is hanging in native code, not in managed code - making it a lot harder to diagnose. – Daniel Hilgarth Jan 08 '13 at 16:56

0 Answers0