0

我正在开发一个工具来将 dcmfiles 中的更改导出到 excel 文件..

我有这个错误发生在其他机器上但不是我的

(指数数组的边界之外)

以下是故障描述:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at WindowsApplication1.Mdl_GetDifference.compareParsedDCMTotalRepo(DCMStruct[] myDCMs, Worksheet& xlSheetRev, Int32& FileRow, Int32 SvnNo, String FName, String baseline)
   at WindowsApplication1.ToExcel.GenTotalReport(Worksheet& xlSheetRev, String baseline)
   at WindowsApplication1.ToExcel.ExportToExcel(String baseline)
   at WindowsApplication1.Home.GenRop_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3634 (GDR.050727-3600)
    CodeBase: file:///C:/WINNT/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
AdvertTest
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file://bosch.com/dfsrb/DfsDE/DIV/BEG/EC/Common/Arbeitshilfen/Tools/Advert/00_temp/BetaTest_Version/AdvertTest.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3634 (GDR.050727-3600)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3637 (GDR.050727-3600)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3639 (GDR.050727-3600)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/WINNT/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Interop.PushOkSvn
    Assembly Version: 1.3.0.0
    Win32 Version: 1.3.0.0
    CodeBase: file://bosch.com/dfsrb/DfsDE/DIV/BEG/EC/Common/Arbeitshilfen/Tools/Advert/00_temp/BetaTest_Version/Interop.PushOkSvn.DLL
----------------------------------------
Microsoft.Office.Interop.Excel
    Assembly Version: 12.0.0.0
    Win32 Version: 12.0.6600.1000
    CodeBase: file:///C:/WINNT/assembly/GAC/Microsoft.Office.Interop.Excel/12.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Excel.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

如果需要,我可以添加更多信息.. 请任何帮助将不胜感激

 Public Sub compareParsedDCMTotalRepo(ByVal myDCMs() As DCMStruct, ByRef xlSheetRev As Worksheet, ByRef FileRow As Integer, ByVal SvnNo As Integer, ByVal FName As String, ByVal baseline As String)

    ' is completly the same with function compareparsedDCM but just writing into excel is different, here we added few more coloums to excel

    Dim myVal1, myVal2, myVal1X, myVal2X, myVal1Y, myVal2Y, index2 As String
    Dim myName1 As String '= ""
    Dim k, l, m
    Dim FileCol As Integer = 1
    Dim ParameterCol As Integer = 2
    Dim ParTypeCol As Integer = 3
    Dim OldValCol As Integer = 4
    Dim NewValCol As Integer = 5
    Dim ChgByCol As Integer = 6
    Dim CommCol As Integer = 7
    Dim RevCol As Integer = 8
    Dim GenCommCol As Integer = 12
    Dim TcmInfoCol As Integer = 13
    Dim BaselineCol As Integer = 14

    FName = FName.Substring(FName.LastIndexOf("/") + 1)

    CommColl.Clear()

    loadCommColl(SvnData(SvnNo).CommitComment)


    '''''''''''''''''''''''''''''''''''''''' The following handles with the Festwert part.''''''''''''''''''''''''''''''
    ' checking all the festwert values of old file and new file
    For k = LBound(myDCMs(0).FESTWERT) To UBound(myDCMs(0).FESTWERT)

        If myDCMs(0).FestwCount < 1 Then
            Exit For
        End If
        myName1 = myDCMs(0).FESTWERT(k).Name
        myVal1 = myDCMs(0).FESTWERT(k).Value

        index2 = -1  ' index2 is used to find if name of the Parameter in old DCM also exists in the new one.
        ' This step checks, whether this Festwert is changed in the new DCM file by looking for its name in the FESTWERTMap.
        If myDCMs(1).FESTWERTMap.Contains(myName1) Then
            index2 = myDCMs(1).FESTWERTMap(myName1)
        End If

        If index2 < 0 Then
            ' if index is <0 means its not there that is removed from the file
            ' so, we are writing the same into excel file
            xlSheetRev.Cells(FileRow, FileCol) = FName
            xlSheetRev.Cells(FileRow, ParameterCol) = myName1
            xlSheetRev.Cells(FileRow, ParTypeCol) = "Festwert"
            xlSheetRev.Cells(FileRow, OldValCol) = myVal1
            xlSheetRev.Cells(FileRow, NewValCol) = "Removed"
            xlSheetRev.Cells(FileRow, ChgByCol) = ParamAuthor.Item(FName & ";" & myName1)
            xlSheetRev.Cells(FileRow, CommCol) = ParamCommTotal(SvnNo, FName, myName1)
            If SvnData(SvnNo).RevNo <> 0 Then
                xlSheetRev.Cells(FileRow, RevCol) = SvnData(SvnNo).RevNo
            End If
            xlSheetRev.Cells(FileRow, GenCommCol) = getGenComment()
            xlSheetRev.Cells(FileRow, TcmInfoCol) = myName1 & ":" & myVal1 & "-->" & "Removed"
            xlSheetRev.Cells(FileRow, BaselineCol) = baseline
            FileRow = FileRow + 1
            findInfoHRevParam(SvnNo, FName, myName1)
        Else ' if the FW exists, check if it was changed
            myVal2 = myDCMs(1).FESTWERT(index2).Value ' get the new valua.
            If diffValue(myVal1, myVal2) Then
                ' comparing the oldvalues and newvalues, if they are not equal then chaged. Has to be written in Excel.
                xlSheetRev.Cells(FileRow, FileCol) = FName
                xlSheetRev.Cells(FileRow, ParameterCol) = myName1
                xlSheetRev.Cells(FileRow, ParTypeCol) = "Festwert"
                xlSheetRev.Cells(FileRow, OldValCol) = myVal1
                xlSheetRev.Cells(FileRow, NewValCol) = myVal2
                xlSheetRev.Cells(FileRow, ChgByCol) = ParamAuthor.Item(FName & ";" & myName1)
                xlSheetRev.Cells(FileRow, CommCol) = ParamCommTotal(SvnNo, FName, myName1)
                If SvnData(SvnNo).RevNo <> 0 Then
                    xlSheetRev.Cells(FileRow, RevCol) = SvnData(SvnNo).RevNo
                End If
                xlSheetRev.Cells(FileRow, GenCommCol) = getGenComment()
                xlSheetRev.Cells(FileRow, TcmInfoCol) = myName1 & ":" & myVal1 & "-->" & myVal2
                xlSheetRev.Cells(FileRow, BaselineCol) = baseline
                FileRow = FileRow + 1
                findInfoHRevParam(SvnNo, FName, myName1)
            End If
        End If
    Next k

    ' If there is newly added FW.
    For k = LBound(myDCMs(1).FESTWERT) To UBound(myDCMs(1).FESTWERT)
        If myDCMs(1).FestwCount < 1 Then
            Exit For
        End If
        myName1 = myDCMs(1).FESTWERT(k).Name
        If myDCMs(0).FESTWERTMap.Contains(myName1) = False Then
            xlSheetRev.Cells(FileRow, FileCol) = FName
            xlSheetRev.Cells(FileRow, ParameterCol) = myName1
            xlSheetRev.Cells(FileRow, ParTypeCol) = "Festwert"
            xlSheetRev.Cells(FileRow, OldValCol) = "Added"
            xlSheetRev.Cells(FileRow, NewValCol) = myDCMs(1).FESTWERT(k).Value
            xlSheetRev.Cells(FileRow, ChgByCol) = ParamAuthor.Item(FName & ";" & myName1)
            xlSheetRev.Cells(FileRow, CommCol) = ParamCommTotal(SvnNo, FName, myName1)
            If SvnData(SvnNo).RevNo <> 0 Then
                xlSheetRev.Cells(FileRow, RevCol) = SvnData(SvnNo).RevNo
            End If
            xlSheetRev.Cells(FileRow, GenCommCol) = getGenComment()
            xlSheetRev.Cells(FileRow, TcmInfoCol) = myName1 & ":" & "Added-->" & myDCMs(1).FESTWERT(k).Value
            xlSheetRev.Cells(FileRow, BaselineCol) = baseline
            FileRow = FileRow + 1
            findInfoHRevParam(SvnNo, FName, myName1)
        End If
    Next

结束子

4

1 回答 1

0

确保同时发送 .pdb 文件,因为它们包含显示在异常堆栈跟踪中的行号信息。

System.IndexOutOfRangeException:索引超出了数组的范围。
  在 WindowsApplication1.Mdl_GetDifference.compareParsedDCMTotalRepo(DCMStruct[] myDCMs, Worksheet& xlSheetRev, Int32& FileRow, Int32 SvnNo, String FName, String baseline) :line 20
  at WindowsApplication1.ToExcel.GenTotalReport(Worksheet& xlSheetRev, String baseline) :line 35
...

(我使用的数字只是示例)

然后,您将知道在哪个代码行上引发了异常。

于 2012-11-27T14:53:11.897 回答