25

I am trying to create a custom membership and role provider. The code for this seems to be fine, but when I try to go to the Security section of the Web Site Administration Tool, I get the following:

The invoked member is not supported in a dynamic assembly.

In reference to the first line of the first bit of NHibernate-related code that is called:

var cfg = new Configuration();

followed by:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

Additional information: Could not load file or assembly 'NHibernate.XmlSerializers, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The system cannot find the file specified.

Before that I get a few:

Culture name 'aspx' is not supported.

I have the providers in the App_Code folder and the NHibernate DLLs are copied to the Bin folder on execution of the application.

I am assuming it is to do with the providers not being able to find all of the relevant classes and dlls related to NHibernate and the Role class and so on.


For whatever reason, this problem went away.

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141
BobTurbo
  • 489
  • 1
  • 6
  • 12
  • 11
    I think this is a good question. There are times when it's useful to break on CLR exceptions, and the NHibernate.XmlSerializers exception is a distraction. The workaround is to generate a local copy of NHibernate.XmlSerializers.dll and put it in the same directory as NHibernate.dll. Instructions here: http://www.codewrecks.com/blog/index.php/2008/02/13/sgenexe-and-strongly-named-assemblies/. NHibernate.snk here: https://github.com/nhibernate/nhibernate-core/blob/master/src/NHibernate.snk. sgen.exe NHibernate.dll /type:NHibernate.Cfg.MappingSchema.HbmMapping /compiler:/keyfile:NHibernate.snk – RedGreenCode Mar 03 '14 at 01:13
  • as unlikely as it is, this question's answer just helped me. – Moritz Both Jun 09 '21 at 11:11

1 Answers1

37

I had the same thing, turns out it wasn't really a problem. I had IDE set so that it will break on Exceptions

After reading this link below I realised.

http://www.mail-archive.com/nhusers@googlegroups.com/msg06043.html

You can simply hit F5 and continue running. That's pretty much all I know

David
  • 371
  • 3
  • 3