Search code examples
.netunhandled-exceptiontypeloadexception

Can someone assist in understanding the cause of .Net Runtime Exception Info: System.TypeLoadException based on info provided?


I have an application that is triggering .Net Runtime Exception Info: System.TypeLoadException then crashes when trying to launch. I have tried to uninstal the application and reinstal. I did discover that it all started around the time it was updated. I have not tried to roll back to previous version yet only updated to a beta version which worked. If permissible, a side question is there any recommended materials that may guide me in understanding this even error? Especially if it can give a fairly good break down.

UPDATE: This is not our software and I have tried reaching out to the Vendor and waiting on a response again. Out of all our users we only have 1 person with this issue and version since being updated.

Thanks in advance.

Application: ndClickWinTray.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeLoadException
   at ndClickWinTray.NdClickTrayIcon.SetDelegates()
   at ndClickWinTray.NdClickTrayIcon..ctor(ndClickWinTray.BusinessLogic.Infrastructure.Interfaces.IContainer, NetDocuments.Login.Contracts.Interfaces.IEventStream, NetDocuments.Login.Contracts.Interfaces.IUserAdapter, NetDocuments.Login.Contracts.Interfaces.IExceptionLogger, NetDocuments.Login.Contracts.Interfaces.IAuthenticationAdapter, NetDocuments.Login.Presentation.Infrastructure.IDialogFactory)
   at DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure)
   at SimpleInjector.Lifestyles.SingletonLifestyle+SingletonLifestyleRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateInstance(System.Func`1<System.__Canon>)
   at SimpleInjector.Lifestyles.SingletonLifestyle+SingletonLifestyleRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateInstanceWithNullCheck()
   at SimpleInjector.Lifestyles.SingletonLifestyle+SingletonLifestyleRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetInterceptedInstance()
   at SimpleInjector.Lifestyles.SingletonLifestyle+SingletonLifestyleRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BuildExpression()
   at SimpleInjector.InstanceProducer.BuildExpressionInternal()
   at SimpleInjector.Internals.LazyEx`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Value()
   at SimpleInjector.InstanceProducer.BuildExpression()

Exception Info: SimpleInjector.ActivationException
   at SimpleInjector.InstanceProducer.BuildExpression()
   at SimpleInjector.InstanceProducer.VerifyExpressionBuilding()

Exception Info: System.InvalidOperationException
   at SimpleInjector.InstanceProducer.VerifyExpressionBuilding()
   at SimpleInjector.Container.VerifyThatAllExpressionsCanBeBuilt(SimpleInjector.InstanceProducer[])
   at SimpleInjector.Container.VerifyThatAllExpressionsCanBeBuilt()
   at SimpleInjector.Container.VerifyInternal(Boolean)
   at SimpleInjector.Container.Verify(SimpleInjector.VerificationOption)
   at ndClickWinTray.App.RegisterTypes()
   at ndClickWinTray.App.OnStartup(System.Windows.StartupEventArgs)
   at System.Windows.Application.<.ctor>b__1_0(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run(System.Windows.Window)
   at ndClickWinTray.App.Main()
   at ndClickWinTray.Program.Main(System.String[])

Solution

  • Is this your application or a 3rd party one?

    TypeLoad exceptions occur usually when 3rd party references end up being mismatched. You already hinted that this was observed aften an update, it sounds like a 3rd party dll is expected but unable to be loaded.

    If this is your project code, then check that you have consolidated all your NuGet references to the same versions, this is a very common issue to experience.

    Your particular issue is complicated by the implementation of dynamic script compilation, so we won't see the error during compilation, only at runtime.

    Again, if this is your code, you should catch the exception and handle it, you may get deeper insights into the underlying cause.

    Have you had a read through these posts on SO?: