T
Trecius
Hello, Newsgroupians:
I have a question that is troubling me. I have a COM / OLE component that I
am adding to my C# project. In creating a wrapper class for the component, I
have declared the class as static as well as every member and function in the
class, which is -- of course -- required.
Well, when trying to use my wrapped class, the first call to the class calls
the static constructor for the class. I only have one line in the static
constructor.
public static class PressureWrapper
{
private static PressureManager m_pmanager = null;
static PressureWrapper()
{
PressureWrapper.m_pmanager = new PressureManager();
}
}
That's all. However, after hanging for about two minutes, the static
constructor finally thows an exception. Two things puzzle me, if the
original OEM program is running, the static constructor works just fine and
my code will continue to execute and not hang. Also, if I don't make the
class or the member variable static, I am able to create the object, and the
program can continue to execute. This is illustrated below:
public class PressureWrapper
{
private PressureManager m_pmanager = null;
public PressureWrapper()
{
this.m_pmanager = new PressureManager();
}
}
public static void main()
{
PressureWrapper pw = new PressureWrapper();
pw.SomeFunc();
}
In this case it works. Any ideas?
Thank you, all.
Trecius
I have a question that is troubling me. I have a COM / OLE component that I
am adding to my C# project. In creating a wrapper class for the component, I
have declared the class as static as well as every member and function in the
class, which is -- of course -- required.
Well, when trying to use my wrapped class, the first call to the class calls
the static constructor for the class. I only have one line in the static
constructor.
public static class PressureWrapper
{
private static PressureManager m_pmanager = null;
static PressureWrapper()
{
PressureWrapper.m_pmanager = new PressureManager();
}
}
That's all. However, after hanging for about two minutes, the static
constructor finally thows an exception. Two things puzzle me, if the
original OEM program is running, the static constructor works just fine and
my code will continue to execute and not hang. Also, if I don't make the
class or the member variable static, I am able to create the object, and the
program can continue to execute. This is illustrated below:
public class PressureWrapper
{
private PressureManager m_pmanager = null;
public PressureWrapper()
{
this.m_pmanager = new PressureManager();
}
}
public static void main()
{
PressureWrapper pw = new PressureWrapper();
pw.SomeFunc();
}
In this case it works. Any ideas?
Thank you, all.
Trecius