Try initialising in a static constructor and catch the error there - see if
it still occurs and examine it. Might give you a better idea.
class Logger
{
static Logger lInstance;
static Logger()
{
try
{
lInstance = new Logger();
}
catch (TypeInitializationException tie)
{
// Examine contents here
}
}
}
<li***@centrum.cz> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
Hi,
I have singleton class in C#:
class Logger
{
static Logger lInstance = new Logger();
private Logger() {}
public static Logger GetInstance() { return lInstance; }
}
When I want to access it from another assembly, like Logger l =
Logger.GetInstance(), I get TypeInitializationException ->
NullReferenceException. Any help?