1
 Public class Test{
   public string name {get;set;}
   }

Trying to serialize this class

XmlSerializer serlzer = new XmlSerializer(typeof(Test));

is showing error as The filename, directory name, or volume label syntax is incorrect. (Exception from HRESULT: 0x8007007B) + System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(int, System.IntPtr) + Microsoft.Win32.Fusion.ReadCache(System.Collections.ArrayList, string, uint) + System.Reflection.RuntimeAssembly.EnumerateCache(System.Reflection.AssemblyName) + System.Reflection.RuntimeAssembly.LoadWithPartialNameInternal(System.Reflection.AssemblyName, System.Security.Policy.Evidence, ref System.Threading.StackCrawlMark) + System.Reflection.Assembly.LoadWithPartialName(string, System.Security.Policy.Evidence) + System.Xml.Serialization.TempAssembly.LoadGeneratedAssembly(System.Type, string, out System.Xml.Serialization.XmlSerializerImplementation) + System.Xml.Serialization.XmlSerializer..ctor(System.Type, string) + System.Xml.Serialization.XmlSerializer..ctor(System.Type)

Done all these in C# interactive in visual studio 2015 in .NET 4.6.1 environment

1 Answers1

0

the issue is that generated assembly name for script assemblies contains an invalid character for the file system (#), and when the serializer attempts to load a serialization assembly, it fails.

try to reinstall the assembly again and see if that works, it happens sometimes that the assembly contains invalid characters.

Barr J
  • 10,636
  • 1
  • 28
  • 46