mMembersList = Count = Exception of type: '{System.TypeLoadException}' occurred.

mMembersList = Count = Exception of type: '{System.TypeLoadException}' occurred.

Old forum URL: forums.lhotka.net/forums/t/1911.aspx


Nemisis posted on Wednesday, December 06, 2006

Hi everyone,

Can someone please help me with this error, everything was going fine until i started to develop a parent object with a child list.  Now i get this error everytime, and i dont know how to fix it.

The code i am running is as follows

Private mMembersList As AllianceMemberList = AllianceMemberList.NewAllianceMemberList

Friend
Shared Function NewAllianceMemberList() As AllianceMemberList
     Return New AllianceMemberList
End Function

Private Sub New()
     MarkAsChild()
End Sub

And the error message i get it

mMembersList = Count = Exception of type: '{System.TypeLoadException}' occurred.

Please please please someone help.  Thanks in advance!

ajj3085 replied on Wednesday, December 06, 2006

Could you post the exact exception details, and possibly more code?  Nothing you posted looks like it should be throwing an exception.

Nemisis replied on Wednesday, December 06, 2006

This is partly the problem, because this is the error message i get, no more,  no less.

And it really isnt enough to find out why the error is occurring.

I have attached the classes to this reply, so if you can get it too work, or even better, error and find a fix, that would be great.

Btw, thanks for the quick reply.  Hope you can help

ajj3085 replied on Wednesday, December 06, 2006

Hmm, nothing seems wrong with the code... I would check references, and also check any inner exceptons.

Nemisis replied on Wednesday, December 06, 2006

Ok, we are using version 2.0 of the Csla framework as thats the one that came with the book, and we are new to it at the moment, could this be a bug in this version?

Should i be thinking of upgrading to a later framework?  I have looked at some of the notes and it says that the newer versions might break code.  is this because the code is alot different?

So far as i know there are no inner exceptions but i will have a look over it and let you know.

Thanks again for looking so quickly

ajj3085 replied on Wednesday, December 06, 2006

Well, some assembly isn't being loaded properly, so you may have to enable binding logging.  Just turn it off when you're done, because its a big perf hit.   I don't think upgrading will work for this error, although its a good idea because there are some good improvements and of course bug fixes in the latest version which is 2.1.1.

Andy

Nemisis replied on Thursday, December 07, 2006

Andy,

Sorry if it sounds stupid, but what do you mean by 'binding logging'?  And how do i turn it on/off?

Thanks

ajj3085 replied on Thursday, December 07, 2006

Assembly binding is the process that .Net uses to locate an assembly's dependancies.   For example, your application may use System.Windows.Forms.  There's a whole process .net uses to find it.

So if you have an assembly MyApp referencing another called MyLibrary, .Net would look for:

MyLibrary.dll in same folder as MyApp
MyLibrary.exe in same folder as MyApp
MyLibrary.dll in other locations
MyLibrary.exe in other locations
MyLibrary in the GAC

That's just an example search, and by no means is the order .Net actually looks in (it may be, but I don't know).  To turn the logging on you need to modify a registry value used by Fusion (which is the part of .Net that tries to find requested assemblies to load).  Read more about it here.

jwooley replied on Friday, December 29, 2006

It sounds like you are running into the same problem that I have seen with Project Tracker (see the following thread: http://forums.lhotka.net/forums/thread/7305.aspx).

Jim Wooley

Copyright (c) Marimer LLC