2013-01-09 48 views
5

मैं, दृश्य स्टूडियो में ब्रेक अंक में से कुछ सेट को परिभाषित करने के लिए इतना है कि मैं उन के बीच टॉगल कर सकते हैं चाहता हूँ।कैसे दृश्य स्टूडियो में ब्रेक अंक के सेट को परिभाषित करने के लिए?

सेट करें, मेरा मतलब है कि परिभाषित कुछ पंक्तियों पर ब्रेक पॉइंट का संग्रह। मेरे पास कई डिस्प्ले हैं जो मैं अपने डिबगिंग को कम करने के लिए इन सेटों में टॉगल करना चाहता हूं।

उदाहरण के लिए:

Set 1: breakpoints at line 1, line 3, line 5, line 7 
Set 2: breakpoints at line 2, line 4, line 6, line 8, 

वहाँ हैं दृश्य स्टूडियो (2008 और इसके बाद के संस्करण पसंद किया जाता है) में यह करने के लिए किसी भी तरीके हैं, या कोई ऐड-इन्स कर रहे हैं?

उत्तर

2

यह सुविधा विजुअल स्टूडियो 2010 और 2012 में ब्रेकपॉइंट विंडो में उपलब्ध है। http://msdn.microsoft.com/en-us/library/dd293674.aspx

(ग) दृश्य स्टूडियो टीम (उत्पाद टीम, माइक्रोसॉफ्ट) नवंबर 21, 2012

http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2394909-breakpoint-sets-or-groups-enable-disable-breakp

इसके अलावा, यहां छोटे से मैक्रो को विजुअल स्टूडियो 2008 आप कर सकते हैं में इस कार्यक्षमता को लागू करता है बस मैक्रो में किसी भी मॉड्यूल में कॉपी (उपकरण> मैक्रो> मैक्रो एक्सप्लोरर> किसी भी मॉड्यूल राइट क्लिक करें> संपादित करें> वहाँ पेस्ट), और फिर इसे किसी भी मेनू के लिए एक आदेश के रूप में जोड़ें (उपकरण के माध्यम से> कस्टमाइज़ करें ...)

Dim savePath = "c:\temp" 
Sub SaveBreakpoints() 
    Dim fname As String 
    Dim lBreakpointsList As System.Collections.Generic.List(Of Breakpoint) 
    Dim fileList = IO.Directory.GetFiles(savePath) 
    Dim lFiles = "" 
    For Each lFile In fileList 
     lFiles = String.Concat(lFiles, IO.Path.GetFileNameWithoutExtension(lFile), vbCrLf) 
    Next 
    fname = InputBox(String.Concat("Existing sets:", vbCrLf, lFiles, vbCrLf, "Name of new set:"), "Save Breakpoints", "1") 
    If fname = "" Then 
     Return 
    End If 
    lBreakpointsList = New System.Collections.Generic.List(Of Breakpoint) 
    For Each lBreakpoint As EnvDTE.Breakpoint In DTE.Debugger.Breakpoints 
     lBreakpointsList.Add(New Breakpoint(lBreakpoint.File, lBreakpoint.FileLine, lBreakpoint.Condition)) 
    Next 

    Using fs As New IO.StreamWriter(String.Concat("c:\temp\", fname, ".txt")) 
     For Each lBreakpoint As Breakpoint In lBreakpointsList 
      fs.WriteLine(String.Format("{0} ||| {1} ||| {2}", lBreakpoint.File, lBreakpoint.Line, lBreakpoint.Condition)) 
     Next 
    End Using 
End Sub 

Sub RestoreBreakpoints() 
    Dim fname As String 
    Dim lBreakpointsList As System.Collections.Generic.List(Of Breakpoint) 
    Dim lProperties As String() 
    Dim fileList = IO.Directory.GetFiles(savePath) 
    Dim lFiles = "" 
    For Each lFile In fileList 
     lFiles = String.Concat(lFiles, IO.Path.GetFileNameWithoutExtension(lFile), vbCrLf) 
    Next 
    fname = InputBox(String.Concat("Enter name of set to restore. Existing sets:", vbCrLf, vbCrLf, lFiles), "Restore Breakpoints", "1") 
    If fname = "" Then 
     Return 
    End If 
    lBreakpointsList = New Collections.Generic.List(Of Breakpoint) 
    Dim lBp As Breakpoint 
    Using fs As New IO.StreamReader(String.Concat("c:\temp\", fname, ".txt")) 
     While Not fs.EndOfStream 
      lProperties = fs.ReadLine().Split(New String() {" ||| "}, StringSplitOptions.None) 
      lBp = New Breakpoint(lProperties(0), lProperties(1), lProperties(2)) 
      lBreakpointsList.Add(lBp) 
     End While 
    End Using 
    Try 
     DTE.ExecuteCommand("Debug.DeleteAllBreakpoints") 
    Catch ex As Exception 
    End Try 
    For Each lBp1 As Breakpoint In lBreakpointsList 
     DTE.Debugger.Breakpoints.Add(, lBp1.File, Convert.ToInt32(lBp1.Line), , lBp1.Condition) 
    Next 
End Sub 

Class Breakpoint 
    Public File 
    Public Line 
    Public Condition 

    Public Sub New(ByVal pFile, ByVal pLine, ByVal pCondition) 
     File = pFile 
     Line = pLine 
     Condition = pCondition 
    End Sub 
End Class 
0

आप लाइन की शुरुआत पर क्लिक कर सकते हैं। फिर ब्रेकपॉइंट्स> ब्रेकपॉइंट डालें क्लिक करें। आप इसे प्रत्येक पंक्ति के लिए कर सकते हैं। मुझे लगता है कि आप जो खोज रहे हैं।

+0

आप मेरे सवाल का गलत लग रहा था। मैं ब्रेकपॉइंट्स के सेट के लिए पूछना चाहता हूं – onmyway133

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

  • कोई संबंधित समस्या नहीं^_^