CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

VSTO and CSLA 2.0 Error

rated by 0 users
This post has 17 Replies | 2 Followers

Top 10 Contributor
Posts 9,398
Unfortunately that won't help if my suspicion is correct. The reason being that you can't handle the event in the main AppDomain, only in the sub-AppDomain where your code runs. The exception would be happening in the main AppDomain when it tries to deserialized the principal there...
 
Rocky

This sounds reasonable to me.  Unfortunatly, I don't think VSTO offers anything so clear.  The work around could be to check that the assembly resolve event is handled each time your code runs.. perhaps not nice, but it should work.

Rocky

Not Ranked
Posts 1
borota replied on Thu, Mar 6 2008 11:13 AM

I was having exactly the same problem with VSTO 2.0. Resetting the Principal to be a GenericPrincipal works. In the form's Close event I'd reset the Principal to be GenericPrincipal, and right after the ShowDialog call, set it back to CSLA principal.

I discovered a better solution though. Just drop a BackgroundWorker control on your form while in design mode. You don't necessarily need to do anything with it, just having it, makes the serialization exception go away.

I don't know why this takes care of the issue, if you do, please share.

Top 500 Contributor
Posts 17
andrew123 replied on Mon, Jun 16 2014 8:00 AM

I've just encountered this problem in a Word VSTO using .NET 4.5.1 and CSLA 4.5.501

The serialization workaround made no difference to me, but luckily I have come across this post by MikeGoatly: 

http://forums.lhotka.net/forums/p/11545/55404.aspx#55404

This solved my issue - I had to force the ConfigurationManager to reinitialize BEFORE I set my Principal on the thread.  Not entirely sure why but it works!  If I don't call the ConfigurationManger to force it, I get a Serialization Exception regarding my custom Principal class.

Page 2 of 2 (18 items) < Previous 1 2 | RSS

Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems