Note that there are some explanatory texts on larger screens.

plurals
  1. POC# win form app not working outside rar file
    primarykey
    data
    text
    <p>I have really strange 'bug' that I don't have a clue what it might be about. App is made with VS2010 using .net 4 frame. Beside normal assemblies, it uses MS inter-op for excel. I have Office 2010 installed on client machine.</p> <p>Basically, app parse excel sheet and makes another one (new file) with results. Problem: when I copy an exe file to the desktop (or anywhere else on PC) it is throwing exception, but when it is in archive (RAR) and archive is on the desktop it is working perfectly.</p> <p>I can't install it due they have very restrictive system (telephone company) and that app shouldn't be used at all. (Worker who is parsing it manually, usually takes 3 hours to do it while program does it in 5 sec, so the boss cant know about it, because he thinks they are all hardworking :) ).</p> <p>The problem persists on other machines within company so it isn't isolated case.</p> <p>Any info about it would be APPRECIATED. P.S. If any more info is needed gimme a shout. Here is 'detail' of unhandled exception.</p> <p>See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.</p> <blockquote> <p>************** Exception Text ************** System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. Parameter name: length at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) at System.String.Substring(Int32 startIndex, Int32 length) at ExcelSvjetlana.Form1.buttonObradi_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&amp; m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message&amp; m) at System.Windows.Forms.ButtonBase.WndProc(Message&amp; m) at System.Windows.Forms.Button.WndProc(Message&amp; m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</p> <pre><code>************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.239 (RTMGDR.030319-2300) CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll ---------------------------------------- ExcelSvjetlana Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/sobradovic/Desktop/Interno.exe ---------------------------------------- System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.276 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.258 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Data Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll ---------------------------------------- System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll ---------------------------------------- System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- System.Numerics Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll ---------------------------------------- Microsoft.Office.Interop.Excel Assembly Version: 14.0.0.0 Win32 Version: 14.0.4756.1000 CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Interop.Excel/14.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Excel.dll ---------------------------------------- office Assembly Version: 14.0.0.0 Win32 Version: 14.0.4760.1000 CodeBase: file:///C:/Windows/assembly/GAC_MSIL/office/14.0.0.0__71e9bce111e9429c/office.dll ---------------------------------------- Microsoft.CSharp Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll ---------------------------------------- System.Dynamic Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll ---------------------------------------- Anonymously Hosted DynamicMethods Assembly Assembly Version: 0.0.0.0 Win32 Version: 4.0.30319.239 (RTMGDR.030319-2300) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.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. </code></pre> </blockquote> <pre><code>For example: &lt;configuration&gt; &lt;system.windows.forms jitDebugging="true" /&gt; &lt;/configuration&gt; 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. </code></pre> <p>And here is that code u asked for. Take note that i did change some strings.</p> <pre><code>private void buttonObradi_Click(object sender, EventArgs e) { int brojac = 0; string grade = ""; string grading1 = "2"; string grading2 = "3"; string grading3 = "4"; string grading4 = "1"; string grading5 = "No Answer"; string grading6 = "5"; string grupa = ""; bool citaj = false; bool mozda = false; string odjel = ""; string pododjel = ""; string ocjenica = ""; int prviProlaz = 0; foreach (DataRow redak in excelData.Rows) { if (prviProlaz &gt; 0) { if (brojac == 0) { brojac = 1; grupa = redak[1].ToString(); mozda = false; citaj = false; } else { if (redak[1].ToString() == "") { mozda = true; citaj = false; } else { if (redak[1].ToString() == "Agent Name") { citaj = true; } else if (redak[1].ToString() == grading1 || redak[1].ToString() == grading2 || redak[1].ToString() == grading3 || redak[1].ToString() == grading4 || redak[1].ToString() == grading5 || redak[1].ToString() == grading6) { grade = redak[1].ToString(); mozda = false; } else if (mozda == true) { brojac = 0; } else if (citaj == true) { if (grupa == "Team A" || grupa == "Team M" || grupa == "Team T") { pododjel = "AAAA"; odjel = "CCCC"; } else if (grupa == "Team 1" || grupa == "Team 2") { pododjel = "BBBB"; odjel = "TTTT"; } else if (grupa == "K Team" || grupa == "F Team") { pododjel = "RRRR"; odjel = "SSSS"; } else if (grupa == "Group 1" || grupa == "Group 2" || grupa == "Group 3" || grupa == "Group 4") { pododjel = "FFFF"; odjel = "TTTTT"; } else if (grupa == "Fun group 1" || grupa == "fun group 2" || grupa == "fun group 3" || grupa == "fun group 4" || grupa == "fun group 5") { pododjel = "KKKK"; odjel = "FFFF"; } ocjenica = ocjenica.Trim(); preSort.Rows.Add(redak[0].ToString(), redak[1].ToString(), "", grade, Convert.ToDecimal(redak[4].ToString()), grade.Substring(0, 1), grupa, pododjel, odjel); } } } } else { prviProlaz = 1; } } dataGridView2.DataSource = preSort; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload