2011-08-01 70 views
0

我已經開始得到這個異常:NHibernate的異常 - 外部組件引發的異常

外部組件通過這個代碼拋出的異常

原因:

NHibernate.Cfg.Configuration config = NHibernateSession.Init(
        new SimpleSessionStorage(), 
        mappingAssemblies, 
        new AutoPersistenceModelGenerator().Generate(), 
        configFile); 

這用來工作精細。這是堆棧跟蹤:

at Microsoft.Win32.Win32Native.CreateFile(String lpFileName, Int32 dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES securityAttrs, FileMode dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile) 
    at Microsoft.Win32.Win32Native.SafeCreateFile(String lpFileName, Int32 dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES securityAttrs, FileMode dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile) 
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) 
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) 
    at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated() 
    at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile) 
    at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension) 
    at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources) 
    at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources) 
    at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources) 
    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.XmlSerializer.GenerateTempAssembly(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 NHibernate.Cfg.Configuration..ctor(SettingsFactory settingsFactory) 
    at NHibernate.Cfg.Configuration..ctor() 
    at SharpArch.NHibernate.NHibernateSession.ConfigureNHibernate(String cfgFile, IDictionary`2 cfgProperties) 
    at SharpArch.NHibernate.NHibernateSession.AddConfiguration(String factoryKey, String[] mappingAssemblies, AutoPersistenceModel autoPersistenceModel, String cfgFile, IDictionary`2 cfgProperties, String validatorCfgFile, IPersistenceConfigurer persistenceConfigurer) 
    at SharpArch.NHibernate.NHibernateSession.Init(ISessionStorage storage, String[] mappingAssemblies, AutoPersistenceModel autoPersistenceModel, String cfgFile, IDictionary`2 cfgProperties, String validatorCfgFile, IPersistenceConfigurer persistenceConfigurer) 
    at SharpArch.NHibernate.NHibernateSession.Init(ISessionStorage storage, String[] mappingAssemblies, AutoPersistenceModel autoPersistenceModel, String cfgFile) 

謝謝。

基督教

回答

1
+0

OK感謝。建議CTRL + F5的作品,但爲什麼? – cs0815

+0

我已經這樣做了:http://connect.microsoft.com/VisualStudio/feedback/details/653950/external-component-has-thrown-an-exception並在devenv.exe中的0x77c200b6處收到First-chance異常:0xC0000008:指定了一個無效的句柄。 – cs0815

+0

你的文章真的很有幫助,所以我接受它。刪除trusteer關係爲我工作! – cs0815