View Full Version : InvalidOperationException in version 6.5.0.4
Paul
14-Jul-2009, 09:32 PM
Getting a "Thread exception mode cannot be changed once any Controls are created on the thread" when executing then line EurekaLogSystem.ExceptionHandler.Activate
WinForm application VS2008 Vb.net using Framework 3.5
Paul
admin
14-Jul-2009, 09:37 PM
Hi Paul,
can you create and send to me a little source demo project able to reproduce this issue, so that I'll can identify and fix it for you ASAP, please? :)
Paul
14-Jul-2009, 09:55 PM
I sent you an email with the test project.
I thinnk we should stop doing this in 2 places. Should we continue here or via the e-mail trouble ticket here.
Thank
Paul
Here is the error
" at System.Windows.Forms.NativeWindow.SetUnhandledExce ptionModeInternal(UnhandledExceptionMode mode, Boolean threadScope) at System.Windows.Forms.Application.SetUnhandledExcep tionMode(UnhandledExceptionMode mode, Boolean threadScope) at System.Windows.Forms.Application.SetUnhandledExcep tionMode(UnhandledExceptionMode mode) at EurekaLogSystem.ExceptionHandler.Activate() in c:\Works\Sync Folder\Sources\EurekaLog for Visual Studio\Run-Time\ExceptionHandler.cs:line 216 at AutoSet.Main_Load(Object sender, EventArgs e) in C:\Documents and Settings\Paulbeau12\My Documents\Visual Studio 2008\Projects\AutoSet\AutoSet\AutoSet.vb:line 162 at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m) at System.Windows.Forms.ContainerControl.WndProc(Mess age& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.SafeNativeMethods.ShowWindow( HandleRef hWnd, Int32 nCmdShow) at System.Windows.Forms.Control.SetVisibleCore(Boolea n value) at System.Windows.Forms.Form.SetVisibleCore(Boolean value) at System.Windows.Forms.Control.set_Visible(Boolean value) at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationCo ntext context) at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine) at My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context( Object state) at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()"
admin
15-Jul-2009, 09:20 AM
Hi Paul,
yes we can continue on the ticket system place!
However we are working on this issue and I hope to can send you good news into the next 2 days! :)
binkle
07-Jan-2011, 09:32 AM
Hi,
I know a dll is not yet officially supported by EL but it works fine for me in most cases.
Usually I just need to ensure that EL is activated in the first call of my dll.
I do this in a static constructor if the class first loaded in my dll.
I'm writing an MMC snap-in. Since I switched to the Microsoft Framwork for MMC3.0 I'm no longer able to use EL because of the following error:
System.InvalidOperationException: Thread exception mode cannot be changed once any Controls are created on the thread.
bei System.Windows.Forms.NativeWindow.SetUnhandledExce ptionModeInternal(UnhandledExceptionMode mode, Boolean threadScope)
bei System.Windows.Forms.Application.SetUnhandledExcep tionMode(UnhandledExceptionMode mode, Boolean threadScope)
bei System.Windows.Forms.Application.SetUnhandledExcep tionMode(UnhandledExceptionMode mode)
bei EurekaLogSystem.ExceptionHandler.Activate()
bei Jam.ExchangeServerToolbox.ESTMMC3.ESTMMC3SnapIn..c ctor() in D:\ExchangeServerToolbox\ESTMMC3\ESTMMC3.cs:Zeile 114.
So my questions is now:
Is it possible to make EL not trying to change the exception mode?
Best regards,
Harald Binkle
binkle
07-Jan-2011, 02:57 PM
Hi,
I just implemented a workaround:
I no longer call:
EurekaLogSystem.ExceptionHandler.Activate();
now I assign the events:
//add application exception handlers
Application.ThreadException +=
new System.Threading.ThreadExceptionEventHandler(OnApp licationThreadException);
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(OnCurrentDomainUnha ndledException);
Those event handlers are like this:
//ThreadException handler
static void OnApplicationThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
OnCurrentDomainUnhandledException(sender, new UnhandledExceptionEventArgs(e.Exception, true));
}
//DomainUnhandledException handler
static void OnCurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs eventArgs)
{
Exception ex = e.ExceptionObject as Exception;
if (ex == null)
return;
else
EurekaLogSystem.ExceptionHandler.HandleException(e x);
}
But it would still be better if EL could be activated as usual.
Boro
13-Feb-2011, 01:03 PM
Hello,
I am sorry, but DLLs are not supported by EurekaLog.NET.
There is a topic regarding this feature on the suggestions forum, but it doesn't seem to be very popular.
I'm sure you'd understand that we need to prioritize the feature requests.
binkle
14-Feb-2011, 01:55 PM
Hi,
I know dll is not supported.
But can you tell setting the execption mode is ncessary?
And why don't make it optoinal or simply put it in a try-catch block.
I this is the only think preventing me from using EL in any .NET dll.
If you would support dlls you would cover any other type of .net assemblies too.
Greetings
Harry
binkle
14-Jun-2011, 12:05 PM
Hi,
I do also get this exception in an MMC3.0 snapin.
Yes I know such a project type is not yet supported by EurekaLog, but I would be nice if you can correct this by ignoring that exception or provide an option no to modify UnhandledExceptionMode.
BTW: Why do you set this option?
See also: http://news.eurekalog.com/showthread.php?p=10815#post10815
Greetings
Harry
binkle
14-Jun-2011, 01:50 PM
I just noticed a similar problem has been posted years before:
http://news.eurekalog.com/showthread.php?t=2409
Biljana
21-Jul-2011, 10:27 AM
Hi,
I know dll is not supported.
But can you tell setting the execption mode is ncessary?
And why don't make it optoinal or simply put it in a try-catch block.
I this is the only think preventing me from using EL in any .NET dll.
If you would support dlls you would cover any other type of .net assemblies too.
Greetings
Harry
Hi Harry,
thank you for suggesting the try-catch, we have applied it for the next version.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.