0

I'm getting NullReferenceException error only on customer's computer that is far from me and I can't make breakpoints in the code and debug it. The application is running correctly on my own PC but when the customer runs it, a message will appear that says:

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

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at H.I.S.form.frmTimingAssign.dgReception_CellEndEdit(Object sender, DataGridViewCellEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellEndEdit(DataGridViewCellEventArgs e)
   at System.Windows.Forms.DataGridView.EndEdit(DataGridViewDataErrorContexts context, DataGridViewValidateCellInternal validateCell, Boolean fireCellLeave, Boolean fireCellEnter, Boolean fireRowLeave, Boolean fireRowEnter, Boolean fireLeave, Boolean keepFocus, Boolean resetCurrentCell, Boolean resetAnchorCell)
   at System.Windows.Forms.DataGridView.CommitEditForOperation(Int32 columnIndex, Int32 rowIndex, Boolean forCurrentCellChange)
   at System.Windows.Forms.DataGridView.ScrollIntoView(Int32 columnIndex, Int32 rowIndex, Boolean forCurrentCellChange)
   at System.Windows.Forms.DataGridView.ProcessDownKeyInternal(Keys keyData, Boolean& moved)
   at System.Windows.Forms.DataGridView.ProcessEnterKey(Keys keyData)
   at System.Windows.Forms.DataGridView.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
H.I.S
    Assembly Version: 97.1.29.1
    Win32 Version: 97.01.29.1
    CodeBase: file:///E:/His/Release/H.I.S.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    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.6.1590.0 built by: NETFXREL2
    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.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
System.Runtime.Caching
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Caching/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.Caching.dll
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
System.Data.DataSetExtensions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1590.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.DataSetExtensions/v4.0_4.0.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll
----------------------------------------
DateTimeSelector
    Assembly Version: 1.1.1.0
    Win32 Version: 1.1.1.0
    CodeBase: file:///E:/His/Release/DateTimeSelector.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.

I think the problem is the difference in .NetFramework versions as there are some messages in error like:

 mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1590.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

But I'm not sure to say to customer install my versions of it. where is the problem?

Shaho
  • 182
  • 2
  • 14
  • 1
    check the code in `dgReception_CellEndEdit` – Rahul Apr 18 '18 at 12:01
  • 2
    _"I think the problem is the difference in .NetFramework"_ - no, the exception is thrown in your code, namely in `dgReception_CellEndEdit`. Test that code. We can't answer this for you. If privacy permits it, the least you can do is request a screenshot of the application to see what data they have on screen. – CodeCaster Apr 18 '18 at 12:04
  • 1
    A Tip : you can always put logs in your code, so you will get good required information regarding state of your program in production. – Amit Apr 18 '18 at 12:06
  • I agree with @CodeCaster, it sounds like a genuine application problem. Can you post some code? Btw, even if you can't debug it, you can use more detailed logs or (worst case) build it as "debug" and deploy it with its pdb file... – Francesco B. Apr 18 '18 at 12:06
  • Imagine problem is with my dgReception_CellEndEdit method. How it works here and gets an error there? I've restored their database on my computer and tested it. it works yet – Shaho Apr 18 '18 at 12:15
  • @Shaho - we've dealt with loads of issues like this one - it's something that customer does differently - he or she clicks/tabs out/presses enter/combines something... the DataGridView has tons of events that fire all around, if they do it in some specific way your cell might end up with null values instead of what you expect (because the value isn't propagated at the moment that the event gets handled). Try adding null checks around accessing the property of a cell, or sth similar... in the end, you'll probably want to move the code to some other event where the behavior is more consistent. – veljkoz Apr 18 '18 at 12:28
  • Solved! the problem was with costumer's SQL Server 2005! Some of my queries were running with some errors. – Shaho Apr 25 '18 at 11:04

0 Answers0