The Error as far as I can tell is occurring at one of these line:

SomeClass foo = new SomeClass();
foo.getSomeStuff(id1,id2,id3, connectionString, UserName, Password, out html, out xml);

Here is what SomeClass basically looks like:

public class SomeClass
{
    private static System.AppDomain SomeDomain { get; set; }
    private static SomeUtility utility { get; set; }

    static SomeClass()
    {
        InitializeSomeClass();
    }


    private static void InitializeSomeClass()
    {
        //code here
        utility = (SomeUtility)SomeDomain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "SomeUtility");
    }

    public void getSomeStuff(int id1, int id2, int id3, string connectionString, string UserName, string Password, out string html, out string xml)
    {
        html = xml = "";
        utility.ExtractContent(id1, id2, id3, connectionString, UserName, Password, out html, out xml);
    }

}

I misread the Code when translating it to more general terms. I have corrected it. Does this make anymore sense?

I have very little experience with Static Constructors, but I my instinct tells me the problem might lie somewhere in there.

有帮助吗?

解决方案 2

I believe I found the issue. It is occurring in a 3rd party assembly in the section: "//code here". I didn't include the code earlier for security purposes, but I'll work with the 3rd party for resolution. Thanks all!

其他提示

In your sample code, the SomeDomain property has never been initialized when you execute the following line:

utility = (SomeUtility)SomeDomain.CreateInstanceAndUnwrap(...)

More generally, look at the stack trace and/or run under a debugger - you'll soon see which line is failing and why.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top