views:

126

answers:

1

I am suddenly experiencing an intermittent error using the Google Checkout ASP.NET control "GCheckout."

It is on the first line of code shown below:

 XmlSerializer Ser = new XmlSerializer(ObjectToSerialize.GetType()); //ObjectToSerialize is a CheckoutShoppingCart object

What puzzles me is why it seemed to work all the time before and now only intermittently returns the error shown below.

This library is a huge black box for me and I am a VB.NET person, not C#.

Can someone offer any suggestions?

Thanks

/// <summary>
/// Makes XML out of an object.
/// </summary>
/// <param name="ObjectToSerialize">The object to serialize.</param>
/// <returns>An XML string representing the object.</returns>
/// <example>
/// <code>
/// Car MyCar1 = new Car();
/// byte[] CarBytes = EncodeHelper.Serialize(MyCar1);
/// string CarXml = EncodeHelper.Utf8BytesToString(CarBytes);
/// Car MyCar2 = (Car) Deserialize(CarXml, typeof(Car));
/// // MyCar2 is now a copy of MyCar1.
/// </code>
/// </example>
public static byte[] Serialize(object ObjectToSerialize) {
  XmlSerializer Ser = new XmlSerializer(ObjectToSerialize.GetType()); //ObjectToSerialize is a CheckoutShoppingCart object
  using (MemoryStream MS = new MemoryStream()) {
    XmlTextWriter W = new XmlTextWriter(MS, new UTF8Encoding(false));
    W.Formatting = Formatting.Indented;
    Ser.Serialize(W, ObjectToSerialize);
    W.Flush();
    W.Close();
    return MS.ToArray();
  }
}

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

=== Pre-bind state information ===
LOG: User = NA\MYNAME
LOG: DisplayName = GCheckout.XmlSerializers, Version=1.3.2.0, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL
 (Fully-specified)
LOG: Appbase = file:///C:/My/Code/BESI/BESI/
LOG: Initial PrivatePath = C:\My\Code\BESI\BESI\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\My\Code\BESI\BESI\web.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:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/besi/c1115671/77c4386d/GCheckout.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/besi/c1115671/77c4386d/GCheckout.XmlSerializers/GCheckout.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/My/Code/BESI/BESI/bin/GCheckout.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/My/Code/BESI/BESI/bin/GCheckout.XmlSerializers/GCheckout.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/besi/c1115671/77c4386d/GCheckout.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/besi/c1115671/77c4386d/GCheckout.XmlSerializers/GCheckout.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/My/Code/BESI/BESI/bin/GCheckout.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///C:/My/Code/BESI/BESI/bin/GCheckout.XmlSerializers/GCheckout.XmlSerializers.EXE.
+1  A: 

This is a normal exception for XML serialization. Debug + Exceptions, turn off the check boxes. Use the Sgen.exe tool to pre-compile serialization assemblies, it's a lot faster.

Hans Passant
I could kiss you....Nah! But thanks so much!
Velika