Unit Test Adapter threw exception: Type is not resolved for member ‘FluentNHibernate.Cfg.FluentConfigurationException,FluentNHibernate

I’ve seen this error while running my test project from Visual Studio.

Type Is Not Resolved Exception

Although, I tried several solution alternatives, I couldn´t find a good one. These are some posts I followed,

I finally found the solution by catching the real exception as follows.

  • Fisrtly, I added a try catch block in the line where the exception was being raised. After all, the Type Is Not Resolved exception didn’t give enough information to infer what was wrong.
  • In second place, I debugged setting a break point just after the catch statement


Type Is Not Resolved Exception Detail

  • The I could find the real exception, which said,

The following types may not be used as proxies: SolutionName.Core.ClassName: method InitializeMembers should be ‘public/protected virtual’ or ‘protected internal virtual’

One of my Core classes (one of the classes mapped by NHibertane to the database)  was calling a method named InitializeMembers in the constructor and this method’s signature was public void.

  • I finally fixed it by changing the method’s signature as shown in the image bellow

Reduce the scope of initialization method to private or protected internal

Leave a Reply