Serialization bug workaround in Global.asax

Serialization bug workaround in Global.asax

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


Michael Hildner posted on Monday, June 02, 2008

Greetings,

Not sure why, but I just came across a "Could not load file or assembly" exception in my web app. Been a while since I worked on this project, but never had this issue before. I copied the code from EnterpriseServicesPortal.vb into my Global.asax, but then I get a StackOverflowException.

Stepping  throught the code the last line of ResolveEventHandler

Return [Assembly].Load(args.Name)

Ends up going back into ResolveEventHandler over and over. Wondering if I'm doing something wrong. Any info is appreciated.

Thanks,

Mike

 

 

Michael Hildner replied on Monday, June 02, 2008

What a mess...

I thought I'd try removing the handler, then doing the Assembly.Load as above, then adding the handler again (of course I just try to load the assembly, and return it after the handler is added).

Got rid of the StackOverflowException, but getting some really odd behaviour now. This error occurs when I add/edit a row in a (Infragistics) grid. So I run the app, try to add/edit a row and I still get the FileNotFoundException with the message of "Could not load file or assembly...".

Hit the back button in the browser, do the same thing again, then it works just fine. Next time, the error returns. So it looks like it happening exactly every other time, failing the first, third etc. times.

Urgh. My app doesn't work and right now I'm at a loss on how to fix. Worst of all, it worked fine a few months ago.

Hope everyone is having a better day than I am!

Michael Hildner replied on Monday, June 02, 2008

Well, I'm not sure about the StackOverflow exception, or why I'd get the FileNotFoundException every other time, but I found the root of the issue, so I don't need to worry about those for now.

Originally my business objects were in a seperate project, so that created a .dll. I set my CslaBindingSource(s) to that name. Then it was decided to move the bo's under the App_Code folder. So the TypeName of the data source didn't match anymore. Just needed to reset the TypeName.

slabanum replied on Monday, June 02, 2008

This might be because of the Cassini problem with CSLA bo's.  Could not find the exact thread, but try mapping your project to an actual virtual directory and use IIS instead of cassini.

slabanum replied on Monday, June 02, 2008

It's here actually.

 

http://forums.lhotka.net/forums/thread/6735.aspx

Michael Hildner replied on Monday, June 02, 2008

Thanks for the reply. I always run via IIS as I've seen that issue posted before.

I did find my problem, posted above - in short my TypeName was incorrect on the CslaDataSource. Not sure about the other issues I was running into, but that's a non-issue for me now.

Thanks again,

Mike

Copyright (c) Marimer LLC