12-13-2005 09:40 AM
12-13-2005 01:02 PM
12-14-2005 02:23 PM
Thanks for your reply.
So I tried LV8 and it seemed to make things worse. I was getting exceptions thrown even when trying to load the assemblies in the first place. So I looked online a bit and found a suggestion to try LoadFrom instead of LoadFile. Looking at MSDN LoadFile is described as:
Loads the contents of an assembly file on the specified path.
And LoadFrom is described:
Loads an assembly given its file name or path.
So that's perfectly clear then! Anyway, I tried it and it worked. It fixed my problem in LV8 and even fixed it in LV7.1. Well sort of. What I didn't mention before is that in my dll I actually have two classes that are deserialized. One contains settings and is serialized as XML (for easy editing) and now deserializes quite nicely
The trouble is that the other one contains data, sensitive data, so I have it saved using a BinaryFormatter which first passes through a CryptoStream using RijndaelManaged to encode the data. Basically, when serializing the object is converted into a binary stream, passed through a cryptostream and then written to the disc. When deserializing the object is loaded from the disc, passed back through the crypto stream and when reconstructed into the original object. At least, that's how it works "in theory". As you've no doubt guessed, it doesn't work in practice. It works fine again from a .NET console app, but not from LV. The exception thrown complains about version incompatibility because it expects verions 1.0 and recieved version 1625312273.10500200! I know from bitter experience that this is the result of the decoding not working so the stream that is supposed to be the object is full of junk.
Does anybody know if there is a problem with using the .NET cryptography classes in LV?
Thanks
12-14-2005 02:39 PM
Actually, nevermind. It was a bug on my end. Everything seems to be working now.
Thanks for your help.
12-15-2005 08:31 AM
12-15-2005 09:17 AM
Thanks for your help Brian. I really did think I had put LoadFrom and not LoadFile in my original code, I guess Intellisense sometimes can get you in trouble. It's just really weird that it worked from my .NET console app. Perhaps it only worked because they were all in the same solution even though by console app didn't have a reference to the dll?
Thanks for the helpful links too. I'd see the Suzanne Cook blog before, but the other one I hadn't seen. I will have to try and wrap my head around it sometime. The MSDN documentation is quite confusing on this subject which is especially frustrating when MSDN is usually such a good resource.