Retrieve the LoaderExceptions / Bad Image Format

Today I got :

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
While NHibernate.Mapping.Attributes wnated to do a type crawl on my assembly

or

System.BadImageFormatException: Próbowano załadować program w niepoprawnym formacie. (Exception from HRESULT: 0x8007000B)
While starting up a an .NET application, during core assembly load.

Both where caused by complicated type delcarations:

public class ByIdDictionary<T,ID> : DictionaryBase<T> where T : ModelBase<ID>, IUnsaved, IDictionaryElement<T>, new() where ID : struct {..}
public abstract class DictionaryBase<T> : Dictionary<object, T> where T : class, IUnsaved, IDictionaryElement<T>, new() {..}
public abstract class ModelBase<ID> : UnsavedModelBase where ID : struct {..}

I guess ByIdDictionary was to complicated :(. I found no solution… just abandoned overly complicated design.

2 Comments

  1. I think that this is the case:

    I believe the problem is caused by the Indexing Service locking the obj and bin files, trying to reindex their contents. Simply select your Projects folder in Explorer, go to Properties…, click the Advanced button and disable the checkbox to allow the indexing of the folder and subdirectories and files

    Accidentally found on: Hannes Pavelka blog.

  2. The tool that is used to „Retrieve the LoaderExceptions property” is named FUSLOGVW.exe, is located by default in C:Program FilesMicrosoft Visual Studio 8SDKv2.0Bin. I have tried that one before but it did not seem to work, today I know why. I was stupid enough to think that it does what is meat to just after starting up, and actually it does „Retrieve the LoaderExceptions property” after changing it’s default settings 🙁

Dodaj komentarz