tags:

views:

5998

answers:

4

I made a couple of changes to my working app and started getting the following error at this line of code.

Dim Deserializer As New Serialization.XmlSerializer(GetType(Groups))

And here is the error.

    BindingFailure was detected
    Message: The assembly with display name 'FUSE.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null'

    Message: The assembly with display name 'FUSE.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null'

=== Pre-bind state information ===
LOG: User = DOUG-VM\Doug
LOG: DisplayName = FUSE.XmlSerializers, Version=8.11.16.1, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL
 (Fully-specified)
LOG: Appbase = file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\Laptop\Core Data\Data\Programming\Windows\DotNet\Work Projects\NOP\Official Apps\FUSE WPF\Fuse\bin\Debug\FUSE.vshost.exe.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/FUSE.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/FUSE.XmlSerializers/FUSE.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/FUSE.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///E:/Laptop/Core Data/Data/Programming/Windows/DotNet/Work Projects/NOP/Official Apps/FUSE WPF/Fuse/bin/Debug/FUSE.XmlSerializers/FUSE.XmlSerializers.EXE.

I can not for the life of me figure out what's going on. Any clues?

TIA

Doug

+1  A: 

It appears that you cannot locate the assembly FUSE.XmlSerializers. Check the results of FUSLOGVW to see where it is looking (although the list presented above seems pretty full).

Do you know where this assembly is stored on your computer. Try and locate it and run NGEN on it to see if it is failuring to load for some reason. Make sure this dll is appearing in your Bin/Debug directory. VS doesn't seem to get the dependancies of dependancies and so you have to m,ake sure you have all the files you need yourself sometimes.

Brody
A: 

How did you load the assembly containing the Groups type? I'm guessing you loaded it with Assembly.LoadFrom() because the XML serializer is using the same context (the 'LoadFrom' context) to attempt to load assemblies for serialization. If so, you have a couple of options:

  1. Use Assembly.Load() instead of Assembly.LoadFrom().
  2. Attach a handler to AppDomain.AssemblyResolve to help the CLR find the assembly in question.

HTH, Kent

Kent Boogaart
+17  A: 

The main reason this was happening was because I had a mismatch in the types I was trying to Serialize and Deserialize. I was Serializing ObservableCollection (of Group) and deserializing a business object - Groups which inherited ObservableCollection (of Group).

And this was also part of the problem... From - http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/9f0c169f-c45e-4898-b2c4-f72c816d4b55/

This exception is a part of the XmlSerializer's normal operation. It is expected and will be caught and handled inside of the Framework code. Just ignore it and continue. If it bothers you during debugging, set the Visual Studio debugger to only stop on unhandled exceptions instead of all exceptions.

Doug
Thank you very much, i was playing around with my Debug/Exceptions and forgot. Thanks alot.
Irwin
One of the possible ways to get rid of this problem is check "Just my code" option in Tools -> Options -> Debugging -> General options.
nightcoder
+1  A: 

According to information I found, BindingFailure exception associated with XmlSerializers sometimes does not indicate any error and should be just ignored, but you can sometimes see it i. e. in debug mode, when you have set VS options to show all thrown exceptions.

Source: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=88566&wa=wsignin1.0

Btw. this is more or less one of the things mentioned in the first answer :).

Lucas
Why did you answer if it's already been answered?
John Saunders
Adding additional answers is not a problem, IMO.
Marc Gravell
I've written the answer more precisely, because people kept asking about this issue. I wrote it so the solution would be more visible, although the solution can be different in some cases.
Lucas