कृपया मुझे इसके साथ मदद करें, मैं AsyncCtpLibrary और C# 5 ctp संकलक का उपयोग कर एक कंसोल applicaiton लिख रहा हूं। पहली बार मुझे मिल गया वास्तव में एक कोड है जो इंतजार कर रहा है चलाने के लिए, मैं यह मिल गया:सी # 5 AsyncCtp BadImageFormatException
System.BadImageFormatException was unhandled
Message=An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Source=AsyncCtpLibrary
StackTrace:
Server stack trace:
at [...].<Execute>d__1c.MoveNext()
at [...].Execute()
at [...].<Move>d__1d.MoveNext() in[..]:line 266
Exception rethrown at [0]:
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.<SetException>b__1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
InnerException:
मैं एक dll लापता रहा हूँ संदर्भित किया जा करने के लिए?
महत्वपूर्ण नए सामान
मेरे नाकाम रहने के विधि इस प्रकार है:
public async override Task<bool> Execute()
{
//do stuff
await stuff;
//do other stuff
await base.Execute()
//do other stuff
return true;
}
मैं थोड़ा-थोड़ा गलती पुन: बनाने की कोशिश कर रहा जॉन स्कीट की सलाह का पालन किया है, और अब मैं बता सकता है कि इंतजार आधार निष्पादन() लाइन हत्यारा है! अगर मैं उस पंक्ति को टिप्पणी करता हूं, तो सबकुछ चलता है, अगर मैं इसे छोड़ देता हूं, तो मेरी विधि को कॉल करना तुरंत विफल रहता है (आधार पर पहुंचने पर नहीं। निष्पादन())। तो मुझे लगता है कि सीटीपी कंपाइलर कुछ अजीब करता है। क्यूं कर? मुझे कभी क्या नहीं करना चाहिए? बग कितना बड़ा है?
वर्ष सामान:
संपादित करें:
32bit/64bit जारी करने के लिए के रूप में, अपने सिस्टम 32 बिट (एक आभासी मशीन के अंदर, आप मन) है, और के रूप में तक मुझे पता है AsyncCtpLibrary.dll नहीं है अप्रबंधित कोड शामिल है। मेरी सभी परियोजनाओं (कक्षा पुस्तकालयों और एकल कंसोल ऐप) में सभी इस तरह के टैब बनाते हैं:
संभवतः अभी भी गलत क्या हो सकता है?
संपादित करें: मैं भी फ्यूजन लॉग दर्शक की जाँच की, AsyncCtpLibrary किसी भी त्रुटि के बिना लोड किया जाता है:
*** Assembly Binder Log Entry (6/10/2011 @ 9:04:11 PM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Users\Daver\Documents\Visual Studio 2010\Projects\[...]\bin\Debug\MyApp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = WIN-N74LV38NLV3\Daver
LOG: DisplayName = AsyncCtpLibrary, Version=1.0.4107.18181, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/Daver/Documents/Visual Studio 2010/Projects/[...]/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApp.exe
Calling assembly : MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Daver\Documents\Visual Studio 2010\Projects\[...]\bin\Debug\MyApp.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: AsyncCtpLibrary, Version=1.0.4107.18181, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/Daver/Documents/Visual Studio 2010/Projects/[...]/bin/Debug/AsyncCtpLibrary.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\Daver\Documents\Visual Studio 2010\Projects\[...]\bin\Debug\AsyncCtpLibrary.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: AsyncCtpLibrary, Version=1.0.4107.18181, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Binding succeeds. Returns assembly from C:\Users\Daver\Documents\Visual Studio 2010\Projects\[...]\bin\Debug\AsyncCtpLibrary.dll.
LOG: Assembly is loaded in default load context.
मैं भी <Execute>d__1c
संकलक उत्पन्न की आईएल कोड जाँच वर्ग 'MoveNext() विधि, और केवल एकमात्र असेंबली जो संदर्भ ([assemblyName]) mscorlib, System.Core, और AsyncCtpLibrary हैं।
मैं प्रकट दोनों मेरे dll और AsyncCtpLibrary की की जाँच की, मेरा कहा .corflags 0x00000003 // ILONLY 32BITREQUIRED
, AsyncCtpLibrary कहा .corflags 0x00000009 // ILONLY
, मैं अनिश्चित हूँ इस समस्या हो सकती है यदि।
कृपया मदद करें, मैं विचारों से बाहर हूं!
मैं एसिंक नमूने बना और चला सकता हूं ... – TDaver
मेरी असफल विधि के रूप में है सार्वजनिक एसिंक ओवरराइड कार्य निष्पादन(), जो सामान (अनुक्रमिक रूप से) करता है, फिर कभी-कभी उपयोगकर्ता इनपुट (कंसोल से) के लिए पूछता है, फिर एक सत्य या गलत देता है। क्या यह संभव है कि ओवरराइड इतना है इसके साथ क्या करना है? –
TDaver
@TDaver: मैं उम्मीद नहीं करूँगा, नहीं ... लेकिन यदि आप जितना संभव हो सके इसे कम करने का प्रयास कर सकते हैं, जब तक कि आपके पास कम से कम असफल उदाहरण न हो, इससे वास्तव में मदद मिलेगी। –