C
Chris
Hi There,
I have a rather tricky problem: On one of the Windows XP Pro installations,
my .Net application has nothing more to say then:
System.InvalidOperationException: It is invalid to push a main message loop
in this context. This may cause your application to not respond to Windows
messages.
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
I tried to narrow down the project and used the CLR hosting code described
in this article:
http://www.thecodeproject.com/dotnet/simpleclrhost.asp
This works fine, because the class in the Hi method only shows a message
box, but if this is extended to show a form in a windows message loop e.g.:
namespace Ranjeet.SimpleCLRHost
{
public class HelloHostDemo
{
public void Hi()
{
MessageBox.Show("YOO HOO from the Managed World!", "And now for this
message");
try
{
System.Windows.Forms.Form v_Form = new System.Windows.Forms.Form();
v_Form.Text = "test";
System.Windows.Forms.Application.Run(v_Form);
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
}
}
}
I get the above exception. The .Net installation should be fine, since
non-CLR hosted apps, run fine. Now the problem is, that I have been digging
(internet & source code) the whole day and cannot find the slightest hint
why this exception is thrown.
Any idea - even a vague pointer into the right direction - would be greatly
appreciated.
Thanks,
Chris
I have a rather tricky problem: On one of the Windows XP Pro installations,
my .Net application has nothing more to say then:
System.InvalidOperationException: It is invalid to push a main message loop
in this context. This may cause your application to not respond to Windows
messages.
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
I tried to narrow down the project and used the CLR hosting code described
in this article:
http://www.thecodeproject.com/dotnet/simpleclrhost.asp
This works fine, because the class in the Hi method only shows a message
box, but if this is extended to show a form in a windows message loop e.g.:
namespace Ranjeet.SimpleCLRHost
{
public class HelloHostDemo
{
public void Hi()
{
MessageBox.Show("YOO HOO from the Managed World!", "And now for this
message");
try
{
System.Windows.Forms.Form v_Form = new System.Windows.Forms.Form();
v_Form.Text = "test";
System.Windows.Forms.Application.Run(v_Form);
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
}
}
}
I get the above exception. The .Net installation should be fine, since
non-CLR hosted apps, run fine. Now the problem is, that I have been digging
(internet & source code) the whole day and cannot find the slightest hint
why this exception is thrown.
Any idea - even a vague pointer into the right direction - would be greatly
appreciated.
Thanks,
Chris