System.InvalidOperationException:无法生成临时类(结果= 1) [英] System.InvalidOperationException: Unable to generate a temporary class (result=1)

查看:690
本文介绍了System.InvalidOperationException:无法生成临时类(结果= 1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发使用.NET 3.5的应用程序,并部署它作为一批具有相同的环境机的.exe文件。
然而,一个特定的机器上我碰到下面的错误。堆栈跟踪:

I have developed an application using .net 3.5 and have deployed it as an .exe on a number of machines with the same environment. However, on one particular machine I get the following error. Stack Trace:

查看调用
刚刚在这个时间消息的详细信息的末尾(JIT )调试而不是此对话框

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\wz58eig4.0.cs' could not be found
error CS2008: No inputs specified

   at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
   at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
   at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
   at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
   at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
   at System.Web.Services.Protocols.SoapClientType..ctor(Type type)
   at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
   at SSOClient..ctor()
   at sc.tradesvc.SSOManager..ctor()
   at sc.tradesvc.SSOManager.get_Inst()
   at sc.cashflowgenerator.Controls.LoginForm.btnLogin_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.PerformClick()
   at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)






加载的程序集:

mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

CashflowGenerator
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/DATA/DEVEL/Output/CashflowGenerator.exe

System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

System.Core
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.21022.8 built by: RTM
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll

System.Web.Services
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll

的**的 * 的**的 JIT调试 **的 * 的****
只启用即时(JIT)调试,对于这种
应用程序或计算机的config文件( machine.config中)必须在System.Windows.Forms的部分设置
jitDebugging值。
上的应用程序也必须与调试
编译启用

***** JIT Debugging ******* To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.

例如:



启用JIT调试后,任何未处理的异常
将被发送到计算机上的$ b注册的JIT调试器$ b,而不是由此对话框处理。

When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.

有人能帮助我?

由于我是新来的.NET可能有人还告诉我,为什么临时类需要首先要创建?

As I am new to .net could someone also tell me when why a temporary class needs to be created in the first place?

推荐答案

XML序列化的工作原理是生成代码来执行序列化。这是在为目的的第一次需要创建一个临时组装完成的。

XML Serialisation works by generating code to perform the serialisation. This is done in a temporary assembly created for that purpose the first time it is needed.

然而,这依赖于能够编写的程序集到磁盘。 1

However this relies on being able to write the assembly to disk.1

您选项是:(1)鉴于其运行过程写权限(为ASP.NET应用程序这很可能是用户帐户一个坏主意)。 (2)使用SDK工具( sgen.exe )预。-generate(在开发/编译时间)序列组装,然后使用(和deplot)该程序集

Your options are either to (1) given the user account which is running the process write permission (for an ASP.NET application this is likely to be a bad idea). (2) Use the SDK tool (sgen.exe) to pre-generate (at development/compile time) the serialisation assembly, and then use (and deplot) that assembly.

1 打开的问题:存在的API在内存中动态创建组件:?为什么不这么做

1Open question: the APIs exist to create assemblies dynamically in memory: why not do that?

这篇关于System.InvalidOperationException:无法生成临时类(结果= 1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆