2012-09-21 5 views
2

Strange exception coming out of OdbcConnection.Open()과 관련된 것 같지만 잘 모르겠습니다.System.Transactions.Diagnostics.DiagnosticTrace throwing TypeInitializationException

최근에 Win8로 전환하여이 응용 프로그램을 실행하지 않았습니다. VS2012를 사용하고 있지만 프로젝트가 업그레이드되지 않았습니다. 예외의 덤프는 다음과 같습니다

Unhandled Exception: System.TypeInitializationException: 
The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception. ---> 
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> 
System.TypeInitializationException: The type initializer for 'System.Uri' threw an exception. ---> 
System.TypeInitializationException: The type initializer for 'System.UriParser' threw an exception. ---> 
System.TypeInitializationException: The type initializer for 'System.Runtime.Versioning.BinaryCompatibility' threw an exception. ---> 
System.ArgumentException: String cannot be of zero length. 
Parameter name: frameworkName 
    at System.Runtime.Versioning.BinaryCompatibility.ParseFrameworkName(String frameworkName, String& identifier, Int32& version, String& profile) 
    at System.Runtime.Versioning.BinaryCompatibility.ParseTargetFrameworkMonikerIntoEnum(String targetFrameworkMoniker, TargetFrameworkId& targetFramework, Int32& targetFrameworkVersion) 
    at System.Runtime.Versioning.BinaryCompatibility.ReadTargetFrameworkId() 
    at System.Runtime.Versioning.BinaryCompatibility.get_AppWasBuiltForFramework() 
    at System.Runtime.Versioning.BinaryCompatibility..cctor() 
    --- End of inner exception stack trace --- 
    at System.Runtime.Versioning.BinaryCompatibility.get_TargetsAtLeast_Desktop_V4_5() 
    at System.UriParser..cctor() 
    --- End of inner exception stack trace --- 
    at System.Uri..cctor() 
    --- End of inner exception stack trace --- 
    at System.Configuration.ClientConfigurationSystem..ctor() 
    at System.Configuration.ConfigurationManager.EnsureConfigurationSystem() 
    --- End of inner exception stack trace --- 
    at System.Configuration.ConfigurationManager.PrepareConfigSystem() 
    at System.Configuration.ConfigurationManager.GetSection(String sectionName) 
    at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName) 
    at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection() 
    at System.Diagnostics.DiagnosticsConfiguration.Initialize() 
    at System.Diagnostics.DiagnosticsConfiguration.get_Sources() 
    at System.Diagnostics.TraceSource.Initialize() 
    at System.Diagnostics.TraceSource.get_Switch() 
    at System.Transactions.Diagnostics.DiagnosticTrace..cctor() 
    --- End of inner exception stack trace --- 
    at System.Transactions.Transaction.get_Current() 
    at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.InitClass(IComPlusAdapterContext comPlusContextHost, IPersistenceInfoProvider persistenceInfoProvider) 
    at ZAA.FarmInterface.bw_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) in d:\eddynet\projects\zaa\zaacmdline\farminterface.cpp:line 482 
    at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e) 
    at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg) 
    at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state) 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 
    at System.Threading.ThreadPoolWorkQueue.Dispatch() 
    at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() 

의 App.config 지금처럼 보인다 : 나는 아무 소용, 재건을 시도했습니다

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0"/> 
    </startup> 
    <runtime> 

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 

     <dependentAssembly> <!--For LLBLGen --> 
     <assemblyIdentity name="Npgsql" culture="neutral" publicKeyToken="5d8b90d52f46fda7"/> 
     <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.11.0"/> 

     </dependentAssembly> 
    </assemblyBinding> 

    </runtime> 
</configuration> 

.

app.config에 빈 섹션을 추가하려고 시도했습니다.

.assembly zaacmdline 
{ 
    .custom instance void [mscorlib]System.Runtime.Versioning.TargetFrameworkAttribute::.ctor(string) = (01 00 00 01 00 54 0E 14 46 72 61 6D 65 77 6F 72 // .....T..Framewor 
                            6B 44 69 73 70 6C 61 79 4E 61 6D 65 10 2E 4E 45 // kDisplayName..NE 
                            54 20 46 72 61 6D 65 77 6F 72 6B 20 34)   // T Framework 4 
    .custom instance void [mscorlib]System.Security.SecurityRulesAttribute::.ctor(valuetype [mscorlib]System.Security.SecurityRuleSet) = (01 00 01 00 00) 
    .permissionset reqmin 
     = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} 
    .hash algorithm 0x00008004 
    .ver 0:0:0:0 
} 

TargetFrameworkAttribute가 작업 기계에 비해 확실히 망가입니다 : ILDASM에서 .EXE 오프 매니페스트를 보면


, 나는 이상하게 보이는이를 발견했다. 어떻게 수정해야합니까?

+0

아마도 .net 설치를 어떻게해야할까요? 하지만 Win8에 통합되었습니다 – Thomas

+1

시작 어셈블리의 [TargetFramework] 속성에 문제가 있습니다. 기계에 오래된 베타 버전이 있습니까? 먼저 다시 빌드하십시오. –

+0

RTM OS를 새로 설치하십시오. 다시 내 소스 코드 디렉토리를 재사용. 필자는 일부 릴리스 디렉토리를 삭제하는 것을 포함하여 많은 재구성 작업을 수행했습니다. 뭐라구? – Thomas

답변

7

아래 링크를 보는 것에 대한 의견은 문제를 해결해야합니다. App's .exe file missing .NET TargetFramework, but only on clean builds

는 기본적으로 : 내 app.config 파일에 총액 문제가 있었다 (위의 설명에서) C:\Users\YOURNAME\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cpp

+0

예, 그렇기 때문에 DSN_SLO에 응답으로 제출하도록 요청한 것입니다. – Thomas

+0

구성 시스템을 초기화하지 못했습니다. 이 링크를 참조하십시오. .cpp 파일을 편집해야하는 경우가 발생하여 충분하지 않습니다 (잘못 작성 될 수 있습니다) http://stackoverflow.com/questions/13315940 –

+0

이것은 실제로 작동합니다. 나는 이것을 해결하기 위해 2 일을 보냈다! 고마워요! – Fanda

1

을 삭제합니다. 예 : "connectionstrings"은 "connectionStrings"이어야합니다. 그것은 나를 위해 문제를 해결하는 것 같았다.

희망이 도움이되었습니다.