0

I have an application that I've created using c#. It accesses a Sybase database. The application itself works like a champ. When I close it however, I get this error popup that says my application has crashed. These are the details:

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01:   myProgramName.exe
Problem Signature 02:   1.0.0.0
Problem Signature 03:   54d52bc7
Problem Signature 04:   Sybase.AdoNet4.AseClient
Problem Signature 05:   16.0.0.4
Problem Signature 06:   5400d1c0
Problem Signature 07:   ae
Problem Signature 08:   2d
Problem Signature 09:   System.NullReferenceException
OS Version: 6.1.7601.2.1.0.256.48
Locale ID:  1033
Additional Information 1:   0a9e
Additional Information 2:   0a9e372d3b4ad19135b953a78882e789
Additional Information 3:   0a9e
Additional Information 4:   0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt

What does this mean? How can I fix this?

When accessing Sybase I'm using a, "using" statement:

using (AseConnection conn = new AseConnection(connectionString))
        {
            using (AseCommand cmd = new AseCommand(sql, conn))
            {
                try
                {
                    conn.Open();
                    using (AseDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            table.Add(new TableInformation
                            {
                                info1 = reader.GetInt16(0),
                                info2 = reader.GetString(1),
                                info3 = reader.GetString(2),
                                info4 = reader.GetString(3),
                                info5  = reader.GetString(4),
                                info6 = reader.GetString(5),
                                info7 = reader.GetString(6)
                            });
                        }
                    }
                }
                catch (AseException ex)
                {
                    blah blah blah
                }
            }
        }

I managed to get the exception message. Does this still jive with what you all were thinking?

System.NullReferenceException occurred
Message: A first chance exception of type 'System.NullReferenceException' occurred in Sybase.AdoNet4.AseClient.dll
Additional information: Object reference not set to an instance of an object.
  • I only get this crash about 25% of the time. – UmarSlobberknocker Feb 10 '15 at 15:17
  • Probably has something to do with how you are disposing of your objects in the formclosing / formclosed events. We have no code so we can't guess. – João Miguel Brandão Feb 10 '15 at 15:17
  • This seems like the sybase libary's fault because the AseClient class throws a NullReferenceException somewere. Maybe you are the cause of this because you are not disposing something correctly or whatever, we can't help you further without additional code. – thegentlecat Feb 10 '15 at 15:20
  • Run the program in a debugger and try to reproduce. When the crash occurs, it should give you the exact line it crashes on. – dandan78 Feb 10 '15 at 15:20
  • This is the only place I'm using a Sybase connection. I thought that when the "using" statement was done it would take care of the disposing on its own. – UmarSlobberknocker Feb 10 '15 at 15:23
  • The Sybase ASE .Net client dlls are notoriously buggy. I'd suggest updating to the latest version if you haven't already. – Daniel Kelley Feb 10 '15 at 15:23
  • @DanielKelley, yeah I'm on the latest and greatest version. – UmarSlobberknocker Feb 10 '15 at 15:24
  • Add an unhandled exception handler to try and get more information. https://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception%28v=vs.110%29.aspx – CathalMF Feb 10 '15 at 15:29
  • All useful debugging tips are already covered in "What NullRef is" answer, if bug indeed in library code contacting owner is probably the best option... Asking new question for workaround would probably be off-topic on SO as generally such answers are short lived... – Alexei Levenkov Feb 10 '15 at 15:49
  • @AlexeiLevenkov, from the code above how is a NullRef being generated. It's a simple application that reads from Sybase. Do the, "using" statements truly not dispose and close connections? – UmarSlobberknocker Feb 10 '15 at 15:58
  • @UmarSlobberknocker - there is nothing wrong with the code as written - so getting additional help on SO is unlikely for your problem in current state. The linked question have a lot of information, one piece in particular you should pay attention if you planing to investigate - http://stackoverflow.com/a/21737654/477420 (break on NRE). You may also need ISpy to decompile code or http://stackoverflow.com/questions/16919559/is-it-possible-to-actually-debug-3rd-party-code-using-the-source-decompiled-with – Alexei Levenkov Feb 10 '15 at 16:09
  • @AlexeiLevenkov, good resources. Thank you! – UmarSlobberknocker Feb 10 '15 at 17:37
  • @AlexeiLevenkov, Okay I was able to isolate the issue. System.NullReferenceException occurred Message: A first chance exception of type 'System.NullReferenceException' occurred in Sybase.AdoNet4.AseClient.dll Additional information: Object reference not set to an instance of an object. – UmarSlobberknocker Feb 11 '15 at 15:09
  • @DanielKelley, okay I thought I was on the latest version but maybe I'm not. Do you happen to know the latest version number? I'm currently on 16.0.0.4 – UmarSlobberknocker Feb 11 '15 at 15:52
  • I'm not sure how those versions relate to what I have seen, but the version we use is 4.157.1260.0 (Sybase.AdoNet4.AseClient.dll) – Daniel Kelley Feb 11 '15 at 16:04
  • @DanielKelley, a curious solution. In my code above I'm using the, "using" statements, "(using (AseConnection conn = new AseConnection(connectionString))" and so on. Now I'm not saying that the, "using" statements aren't working correctly, but I am saying that I added conn.close; and conn.dispose(); along with the other appropriate ones and I haven't gotten the nullReferenceException since. I usually get it several times a day and thus far since yesterday when I added the statements, I haven't received the exception once. It's probably just a coincidence... or *is* it? – UmarSlobberknocker Feb 11 '15 at 17:01

0 Answers0