By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,916 Members | 1,286 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,916 IT Pros & Developers. It's quick & easy.

System.InvalidOperationException when trying to Serialize struct

P: n/a
I get an System.InvalidOperationException when trying to Serialize a
struct that has a type refrenced from another library.

The exception is:
System.InvalidOperationException was unhandled
Message="Unable to generate a temporary class (result=1).\r\nerror
CS0012: The type 'SecureSpeak.Protocol.ssContactItem' is defined in an
assembly that is not referenced. You must add a reference to assembly
'SecureSpeak.Protocol, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'.\r\n"
Source="System.Xml"
StackTrace:
at System.Xml.Serialization.Compiler.Compile(Assembly parent,
String ns, CompilerParameters parameters, Evidence evidence)
at
System.Xml.Serialization.TempAssembly.GenerateAsse mbly(XmlMapping[]
xmlMappings, Type[] types, String defaultNamespace, Evidence evidence,
CompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[]
xmlMappings, Type[] types, String defaultNamespace, String location,
Evidence evidence)
at
System.Xml.Serialization.XmlSerializer.GenerateTem pAssembly(XmlMapping
xmlMapping, Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type,
String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
at
SecureSpeak.Client.ConfigManager.do_read_configura tion_data(String
configfile) in
C:\Pub\devel\DotNET20\SecureSpeakClient\SecureSpea kClient\ConfigManager.cs:line
26
at SecureSpeak.Client.ContactsMenu..ctor() in
C:\Pub\devel\DotNET20\SecureSpeakClient\SecureSpea kClient\ContactsMenu.cs:line
39
at SecureSpeak.Client.Program.Main() in
C:\Pub\devel\DotNET20\SecureSpeakClient\SecureSpea kClient\Program.cs:line
15
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

The object I am trying to serialize is pretty simple. Its a struct with
a few string types and another type that is defined in another Dll.
This other type in the Dll is marked as [Serializable]

What am I doing wrong here?? Its all .NET 2.0 in VS.NET 2005.

May 24 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.