2012-05-09 12 views
5

मेरे पास बाज़ार में एक विंडोज फोन 7 ऐप तैनात है जो एक आवधिक टास्क पृष्ठभूमि एजेंट के माध्यम से अपने लाइव टाइल को अपडेट करता है।शेड्यूल्डएक्शन सर्विस.विंड फेंकता है ArgumentException

एक उपयोगकर्ता टाइल के साथ समस्याओं की रिपोर्ट कर रहा है, यह कुछ समय के लिए काम करने के बाद अद्यतन नहीं कर रहा है।

जब वे फोन पर पृष्ठभूमि कार्यों की जांच करते हैं तो यह अक्षम हो जाता है और अगली बार जब मैं इसे खोलता हूं तो "इस एप्लिकेशन के लिए पृष्ठभूमि कार्यों को वापस चालू करें" चेकबॉक्स चेक किया जाता है।

ऐप खोलने और पिन ऑपरेशन को फिर से प्रयास करने के बाद पृष्ठभूमि कार्य फिर से शुरू नहीं हुआ है। Microsoft.Phone.Scheduler.ScheduledActionService.Find को

Problem Function: Microsoft.Phone.Scheduler.SystemNotificationInterop.CheckHr

Exception Type: ArgumentException

Stack Trace:

Frame Image Function Offset
0 coredll.dll xxx_RaiseException 19
1 mscoree3_7.dll WatsonUnhandledManagedException 296
2 mscoree3_7.dll Dbg_NotifyManagedException 93
3 mscoree3_7.dll FirstPassException 1044
4 TransitionStub 0
5 Microsoft.Phone.Scheduler.SystemNotificationInterop.CheckHr 248
6 Microsoft.Phone.Scheduler.SystemNotificationInterop.GetNotificationByID 156
7 Microsoft.Phone.Scheduler.ScheduledActionService.Find 276
8 MyApp.Agents.TaskIsActive 60
9 MyApp.MainPage.SetupApplicationBar 44
10 MyApp.MainPage.MainPage_Loaded 100
11 MS.Internal.CoreInvokeHandler.InvokeEventHandler 3660
12 MS.Internal.JoltHelper.FireEvent 1348
13 mscoree3_7.dll IL_CallManaged 884
14 mscoree3_7.dll IL_CallDelegateInternal 176
15 mscoree3_7.dll makeComPlusCall 5255
16 mscoree3_7.dll makeComPlusCallReturnInt 21
17 0
18 agcore.dll CCoreServices::CLR_FireEvent 385

कॉल एक ArgumentException में जिसके परिणामस्वरूप कर रहे हैं:

मैं इस दो क्रैश रिपोर्ट मैं अनुप्रयोग हब में देखा है से संबंधित हो सकता संदेह है।

नाम पैरामीटर जिसे मैं ढूँढता हूं विधि private const string से आ रहा है, इसलिए मूल्य प्रत्येक कॉल के साथ समान होगा।

क्या मुझे बस इस अपवाद को पकड़ना चाहिए और मान लें कि पृष्ठभूमि एजेंट मौजूद नहीं है या क्या यह इंगित करता है कि एजेंट के साथ कुछ गलत है?

इस चरण में मैं एमुलेटर में ऐप चलाने के दौरान अपवाद को पुन: उत्पन्न नहीं कर सकता।

protected override void OnInvoke(ScheduledTask task) 
{ 
    UpdateTile(); 

#if DEBUG 
    // If we're debugging, fire the task again 
    ScheduledActionService.LaunchForTest("MyScheduledTaskAgent", new TimeSpan(0, 0, 30)); 
    throw new Exception("Bang"); 
#endif 

    NotifyComplete(); 
} 

यह पृष्ठभूमि कार्य दो आमंत्रण के बाद एमुलेटर में सेटिंग के तहत बंद करने के लिए कारण नहीं है:


"When [the] Background Agent crashes two times in sequence, it's removed from scheduling"

मैं जानबूझ कर इस प्रकार हर मंगलाचरण पर ScheduledAgent दुर्घटनाग्रस्त कोशिश की है। हालांकि, अगर मैं एप कॉल को शेड्यूल्डएक्शन सर्विस पर दोबारा खोलता हूं। अपवाद के बिना काम ढूंढें। मैं असफल आवधिक कार्य को भी हटा सकता हूं और बिना किसी समस्या के एक नया उदाहरण जोड़ सकता हूं।


"an exception can be thrown when the background agent is deactivated in the phone's settings. I think in that case the exception is thrown on ScheduledActionService.Add, not ScheduledActionService.Find"

मैं एमुलेटर में यह कोशिश की। मैं ScheduledActionService.Add(task); से निम्न अपवाद प्राप्त करें:

System.InvalidOperationException - "BNS त्रुटि: कार्रवाई विकलांग \ r \ n है" ScheduledActionService.Find को

कॉल अभी भी ठीक काम करते हैं।

+0

"इस चरण में मैं एमुलेटर में ऐप चलाने के दौरान अपवाद को पुन: उत्पन्न नहीं कर सकता।" मुझे पता है कि फोन एजेंट की सेटिंग्स में पृष्ठभूमि एजेंट निष्क्रिय होने पर एक अपवाद फेंक दिया जा सकता है। मुझे लगता है कि उस मामले में अपवाद 'अनुसूचित जाति सेवा' पर डाला गया है, जोड़ें ', अनुसूचित कार्रवाई सेवा नहीं।', लेकिन आपको इसे आज़माएं। –

+0

जब 'पृष्ठभूमि एजेंट' अनुक्रम में दो बार दुर्घटनाग्रस्त हो जाता है, तो इसे शेड्यूलिंग से निकाल दिया जाता है। हो सकता है कि यहां कुछ अपवाद फेंक दिए गए हैं जो इस व्यवहार का कारण बनते हैं ... – Ku6opr

+0

@ Ku6opr, सुझाव के लिए धन्यवाद। मैंने कोशिश की है और परिणाम के साथ सवाल अद्यतन किया है। यह कारण नहीं प्रतीत होता है। –

उत्तर

1

मैं एमुलेटर में और मेरे पीसी से जुड़े हैंडसेट पर ArgumentException और StackTrace को पुन: पेश करने में कामयाब रहा।

चरणों थे:

  1. सेट ScheduledActionService.Find(TASK_NAME)
  2. करने के लिए कॉल के आसपास अपवाद संचालक में एक को तोड़ने बिंदु एमुलेटर (या हैंडसेट) डिबगर संलग्न
  3. उपयोग के साथ में एप्लिकेशन शुरू आवधिक टास्क पृष्ठभूमि एजेंट शुरू करने के लिए पिन मेनू आइटम। ध्यान दें कि डीबग मोड में मैं आवधिक कार्य जोड़ने के तुरंत बाद ScheduledActionService.LaunchForTest(TASK_NAME, new TimeSpan(0, 0, 1)); पर कॉल करता हूं।
  4. मेरे ऐप में एक उप पेज पर नेविगेट करें।
  5. मेनपेज पर वापस जाने के लिए बैक बटन का त्वरित रूप से उपयोग करें और फिर फिर से आवेदक छोड़ने के लिए। मेनपेज पर लोड की गई घटना SetupApplicationBar() पर कॉल करती है, जो अंततः ScheduledActionService.Find() विधि को कॉल करती है।
  6. चूंकि एप्लिकेशन बंद हो रहा है अपवाद होगा।

Exception Type: ArgumentException

Message: E_INVALIDARG

StackTrace:

at Microsoft.Phone.Scheduler.SystemNotificationInterop.CheckHr(Int32 hr)
at Microsoft.Phone.Scheduler.SystemNotificationInterop.GetNotificationByID(Guid notificationID)
at Microsoft.Phone.Scheduler.ScheduledActionService.Find(String name)
at SolarCalculator.Agents.TaskIsActive()
at SolarCalculator.MainPage.SetupApplicationBar()
at SolarCalculator.MainPage.MainPage_Loaded(Object sender, RoutedEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

यह देखते हुए कि एप्लिकेशन बंद हो रहा है और मैं केवल यदि पृष्ठभूमि एजेंट चल रहा है मैं समझ यह अपवाद को पकड़ने और मेरी TaskIsActive() विधि से झूठी वापस जाने के लिए सुरक्षित है यह पता लगाने की कोशिश कर रहा हूँ।

अब मैं ArgumentException से संदेश जानते हैं कि E_INVALIDARG मैं Setting alarm in Windows Phone 7 जब Application_Exit घटना में ScheduleActionService को कॉल कर रहा है जो एक ही त्रुटि मिल रही है वर्णन करता पाया जाता है।

+0

मैंने एक समान क्रैश स्टैक देखा है: http://forums.create.msdn.com/forums/p/106202/625836.aspx#625836 –

संबंधित मुद्दे