acadia
acadia

Reputation: 2621

Could not load type in C#

In my C# class that was working well and suddenly from yesterday when I try to run the program I get the following error. When I try to Build the solution it is building sucessfully.

Could not load type 'FileNet.Api.Admin.IRepository' from

assembly 'FileNet.Api, Version=4.0.0.0, Culture=neutral, PublicKeyToken=63fc2fb3fdeef4f1'.

When I try to debug the solution, I get the above error at the SetOSNames(); I am not able to step into SetOSNames(); method.

Please help

private void IntializeVariables(IConnection connection)
{
    domain = Factory.Domain.FetchInstance(connection, null, null);
    domainName = domain.Name;
    ost = domain.ObjectStores;
    SetOSNames(); ///Error thrown here
}

//
// Intializes the ArrayList osNames with object store names.
//
public void SetOSNames()
{
    IEnumerator ie = ost.GetEnumerator();
    while (ie.MoveNext())
    {
        IObjectStore os = (IObjectStore)ie.Current;
        osNames.Add(os.DisplayName);
    }
}

Upvotes: 3

Views: 3675

Answers (1)

Hans Passant
Hans Passant

Reputation: 941455

The compiler is happy with your code, which indicates that the reference assembly does not match the assembly that's found at runtime. Use the Fuslogvw.exe tool to find out what assembly is getting loaded. Be sure to log all the binds, not just the failed ones. The odds are good that it is finding the wrong version of FileNet.Api.dll, possibly because an old version is stored in the GAC. Avoid using the GAC on your dev machine.

Upvotes: 5

Related Questions