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

"Unable to generate a temporary class"

P: n/a
Hello,

(After investigating my real problem) I've got a C# web service containing a
single method:

[WebMethod]
public MyBDO Test()
{
return null;
}

The MyBDO class is marked as [Serializable] and internally references class
BDOCodeTableItem defined in another assembly. When invoking the method from
web browser, I get the error CS0012, see bellow.

I've already added reference to the assembly both into the Web.config file
and WebService -PropertyPages -References, but it hasn't helped. What am
I to do to fix the problem?

I use Visual Studio 2005, the web service is in C#.

Thank you,

Martin.

-------------------------

System.InvalidOperationException: Unable to generate a temporary class
(result=1).
error CS0012: The type
'Foo.Sys.Core.Common.CodeTables_v2.API.BDO.BDOCode TableItem' is defined in
an assembly that is not referenced. You must add a reference to assembly
'Core.CodeTables_v2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

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.FromMapping s(XmlMapping[]
mappings, Evidence evidence)
at
System.Web.Services.Protocols.XmlReturn.GetInitial izers(LogicalMethodInfo[]
methodInfos)
at
System.Web.Services.Protocols.XmlReturnWriter.GetI nitializers(LogicalMethodInfo[]
methodInfos)
at System.Web.Services.Protocols.MimeFormatter.GetIni tializers(Type type,
LogicalMethodInfo[] methodInfos)
at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)
May 24 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Well,

the solution was to add [XmlInclude(typeof(BDOCodeTableItem))] into the web
service C# definion file.

Best regards,

Martin.

Hello,

(After investigating my real problem) I've got a C# web service containing
a single method:

[WebMethod]
public MyBDO Test()
{
return null;
}

The MyBDO class is marked as [Serializable] and internally references
class BDOCodeTableItem defined in another assembly. When invoking the
method from web browser, I get the error CS0012, see bellow.

I've already added reference to the assembly both into the Web.config file
and WebService -PropertyPages -References, but it hasn't helped. What
am I to do to fix the problem?

I use Visual Studio 2005, the web service is in C#.

Thank you,

Martin.

-------------------------

System.InvalidOperationException: Unable to generate a temporary class
(result=1).
error CS0012: The type
'Foo.Sys.Core.Common.CodeTables_v2.API.BDO.BDOCode TableItem' is defined in
an assembly that is not referenced. You must add a reference to assembly
'Core.CodeTables_v2, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'.

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.FromMapping s(XmlMapping[]
mappings, Evidence evidence)
at
System.Web.Services.Protocols.XmlReturn.GetInitial izers(LogicalMethodInfo[]
methodInfos)
at
System.Web.Services.Protocols.XmlReturnWriter.GetI nitializers(LogicalMethodInfo[]
methodInfos)
at System.Web.Services.Protocols.MimeFormatter.GetIni tializers(Type
type, LogicalMethodInfo[] methodInfos)
at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocol.SetCo ntext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)


May 25 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.