2013-02-12 56 views
7

के साथ काम करता है संपादित करें: मैंने बस वीएस 2010 के साथ यह कोशिश की, और समस्या नहीं हुई। मुद्दा केवल वीएस 2012 के साथ होता है। क्या यह वास्तव में एक बग हो सकता है? यह मेरे दो अलग-अलग लैपटॉप, और यहां तक ​​कि एक दोस्त के लैपटॉप पर भी हो रहा है (जिसे अभी नवीनतम कोड मिला है)।डीबगर वीएस 2012 में नवीनतम चेक-इन कोड छोड़ना - वीएस 2010

सबसे पहले, समस्या का एक स्क्रीनशॉट। यह विधि सभी नया कोड है।

enter image description here

डिबगर मेरी हाल ही में चेक-इन से कोड लंघन है। टिप्पणियां, नीचे दिए गए कोड में, बताएं कि जब मैं इस विधि को डीबग करता हूं तो क्या हो रहा है। तो कोड को आजमाने और समझने की ज़रूरत नहीं है; बस ध्यान दें कि कोड की रेखाएं छोड़ी जा रही हैं। यदि आप सोच रहे हैं कि कोड डीबग किए जाने वाले असेंबली से मेल नहीं खाता है, तो कृपया मेरे साथ भालू। आप देखेंगे कि डीबगर नए कोड को पहचानता है, लेकिन मौजूदा कोड नहीं। और डिस्क पर कोड हटाने और फिर से नवीनतम प्राप्त करने के बाद, यह व्यवहार दो अलग-अलग लैपटॉप पर हो रहा है। प्रत्येक टिप्पणी आपको बताती है कि क्या डीबगर एक लाइन हिट करता है।

[TestMethod()] 
[DeploymentItem("PrestoCommon.dll")] 
public void ApplicationShouldBeInstalledTest_UseCase9() 
{ 
    // Debugger hits this line 
    ApplicationServer appServerAccessor = new ApplicationServer(); 

    // Debugger does not hit these next two lines 
    PrivateObject privateObject = new PrivateObject(appServerAccessor); 
    ApplicationServer appServer = ApplicationServerLogic.GetByName("server10"); 

    // Debugger hits this line. Weirdness: both objects are null, and after this line runs, 
    // appServerAccessor is no longer null. 
    appServerAccessor.Id = appServer.Id; 

    // Skips this line 
    ApplicationWithOverrideVariableGroup appWithValidGroup = appServer.ApplicationsWithOverrideGroup[0]; 

    // Debugger hits this line, but F11 doesn't take me into the method. 
    appWithValidGroup.CustomVariableGroup = CustomVariableGroupLogic.GetById("CustomVariableGroups/4"); 

    // Skips this line 
    Assert.AreEqual(true, true); 
} 

डिस्सेप्लर केवल कोड की रेखाएं दिखाता है जो वास्तव में हिट हो जाते हैं।

enter image description here

अब, यह बाहर की जाँच। यदि मैं कोड की एक नई पंक्ति जोड़ता हूं, तो डीबगर इसे पहचानता है, और कोड की अन्य पंक्तियां, जहां तक ​​डीबगर द्वारा पहचाना जाता है। विधि के भीतर कोड की दूसरी पंक्ति, नई है।

[TestMethod()] 
[DeploymentItem("PrestoCommon.dll")] 
public void ApplicationShouldBeInstalledTest_UseCase9() 
{ 
    // Debugger hits this line 
    ApplicationServer appServerAccessor = new ApplicationServer(); 

    // New line. It's recognized by the debugger, and it shows up in the disassembly. 
    if (DateTime.Now > DateTime.Now.AddHours(1)) { return; } 

    // Debugger does not hit these next two lines 
    PrivateObject privateObject = new PrivateObject(appServerAccessor); 
    ApplicationServer appServer = ApplicationServerLogic.GetByName("server10"); // Gets hit now. 

    // Debugger hits this line. Weirdness: both objects are null, and after this line runs, 
    // appServerAccessor is no longer null. 
    appServerAccessor.Id = appServer.Id; // No longer gets hit. 

    // Skips this line (now it's getting hit) 
    ApplicationWithOverrideVariableGroup appWithValidGroup = appServer.ApplicationsWithOverrideGroup[0]; 

    // Debugger hits this line, but F11 doesn't take me into the method. Now this gets skipped. 
    appWithValidGroup.CustomVariableGroup = CustomVariableGroupLogic.GetById("CustomVariableGroups/4"); 

    // Skips this line. Still skipped. 
    Assert.AreEqual(true, true); 
} 

और यहाँ disassembly के एक आंशिक स्नैपशॉट है, कोड की नई लाइन दिखा:

enter image description here

यह कैसे हो रहा जा सकता है?

एक बिंदु पर, अलौकिकता को जोड़ना यह और भी लौटे:

if (DateTime.Now > DateTime.Now.AddDays(1)) { return; } 

बातें मैं कोशिश की है:
- हार्ड ड्राइव से स्रोत कोड हटाएँ और मजबूर एक मिल नवीनतम
- मरम्मत वी.एस. 2012
- कुछ वी.एस. clean-up
करो - रीबूट
- - अन्य (याद नहीं कर सकते अल उपयोग VS 2010, परिवर्तन कोड, चेक इन, वी.एस. 2012
के साथ नवीनतम मिल उनमें से एल)

+0

क्या आप शायद 'फोर्स इंस्टालेशन' कक्षा दिखा सकते हैं? – MethodMan

+3

अपना कोड पुनर्निर्माण करें। साथ ही, कार्य प्रबंधक में परीक्षण धावक प्रक्रिया की तलाश करें, और इसे रोकें। इसमें आपके कोड का पुराना संस्करण हो सकता है। –

+0

मैंने समाधान बंद कर दिया, फिर से खोल दिया, और इसे फिर से बनाया। वही मुद्दा। ऐसा लगता है कि कुछ एमएसबिल्ड प्रक्रियाएं चल रही हैं। मैं रीबूट करने जा रहा हूं और पुनः प्रयास कर रहा हूं। मैं 'फोर्स इंस्टालेशन' कक्षा पोस्ट करूंगा, भले ही मुझे नहीं लगता कि यह है। –

उत्तर

4

यह यूनिट-टेस्ट विशिष्ट प्रतीत होता है। वी.एस. 2012 में:

  • टेस्ट> टेस्ट सेटिंग
  • ओपन चयनित परीक्षा सेटिंग्स फ़ाइल
  • डाटा और निदान> का चयन रद्द कोड कवरेज (दृश्य स्टूडियो 2010)
  • लागू

ध्यान दें, मुझे स्रोत कोड तक पहुंच का लाभ मिला, और मैंने प्रेस्टो डाउनलोड किया (http://presto.codeplex.com/)।

+1

यह काम किया! यह टेस्ट -> टेस्ट सेटिंग्स में फ़ाइल को अचयनित करके भी काम करता है। –