views:

200

answers:

2

I've got a little struct that I want to serialize in my ViewState. It looks something like this:

[Serializable]
private struct DayMoney
{
    public readonly DateTime ValidFrom;
    public readonly string CurrencyCode;
    public readonly double Amount;
}

It serializes just fine, but when I perform a postback/callback, I get an exception for deserializing it. Wrapped in a long list of InnerException's the root cause seems to be:

Unable to find assembly 'BussinessTripModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Which is kinda ridiculous, because that assembly is definately loaded in the current AppDomain.

WTF?

+1  A: 

Your struct is private. Deserialisation happens in the framework itself, not in your assembly. It's probably that's the problem, make it public and see if that solves it

blowdart
Nop, that doesn't solve it at all. Besides - how could that affect anything, if the framework is unable to find the assembly as such?
Vilx-
Well I was vaguely hoping it might be a bad error message and that it found the assembly but couldn't access the class. Sometimes MS error messages suck :)
blowdart
+2  A: 

This kind of problems is very difficult to diagnose.

My suggestion is to use the Fusion Log Viewer to diagnose why your particular assembly is not found. Keep in mind that some specific options of Fuslogvw that are not so easy to setup, luckily google can help you a lot.

But, to start... make your structure public, as someone else said!!!

massimogentilini
Making it public doesn't help. THe Fusion Log Viewer looks promising, but how do you use it? The MSDN article isn't very helpful...
Vilx-
Ahh, found it. Had to add another path in my <probing> element. Weird still, as it was definately loaded in the current AppDomain - why would it need to search some paths still?
Vilx-