Issue Details (XML | Word | Printable)

Key: DNET-617
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Rand Random
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

NullReferenceException

Created: 29/Jun/15 10:15 AM   Updated: 03/Jul/15 03:31 PM
Component/s: None
Affects Version/s: 4.6.4.0
Fix Version/s: 4.7.0.0

Environment: Win7, Newest FB .Net Provider
Issue Links:
Relate
 


 Description  « Hide
I updated to the latest version of FB .Net Provider.


And I am getting NullReferenceException with the following stacktrace

   bei FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.Write(Int32 value) in c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version10\GdsDatabase.cs:Zeile 1002.

(Yes its only this line)

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura added a comment - 29/Jun/15 10:18 AM
It's impossible to be only this line. Somebody needs to call this method.

Rand Random added a comment - 29/Jun/15 10:28 AM - edited
Here a screenshot of the message:
http://oi59.tinypic.com/2wncp38.jpg

Jiri Cincura added a comment - 29/Jun/15 10:47 AM
Don't know about your VS settings or environment. But somebody really needs to call this method. Unless you provide a test case or further information I can't do anything.

Rand Random added a comment - 29/Jun/15 11:00 AM
Seems like a raise condition to me...

Here is some code where I am "always" getting the exception:

            var dbCon = CreateDbConnection();
            
            if (dbCon.State != ConnectionState.Open)
                dbCon.Open();

            for (int i = 0; i < 300; i++)
            {
                var fbCommand = dbCon.CreateCommand();

                fbCommand.CommandText = "select count(*) from Test where Nr = " + i;
                var result = (int)fbCommand.ExecuteScalar();

                if (result == 0)
                {
                    fbCommand.CommandText = "select count(*) from Test where Nr <> " + i;
                    result = (int)fbCommand.ExecuteScalar();
                }

            }

            dbCon.Dispose();

The problem doesn't occur if I wrap the fbCommand inside a using block (so maybe some cleanup job) and it doesn't occur as frequently when I reduce the for to "only" make 100 iterations.

Jiri Cincura added a comment - 29/Jun/15 11:25 AM
For sure you should dispose the commands. Does the NRE happen on finalizer thread?

Rand Random added a comment - 29/Jun/15 11:28 AM
How would I check this?

Jiri Cincura added a comment - 29/Jun/15 11:30 AM
Well, check on what thread the exception was thrown.

Rand Random added a comment - 29/Jun/15 11:37 AM
It seems so, I have written the CurrentThread into the watch window and that's what I see

Thread.CurrentThread {System.Threading.Thread} System.Threading.Thread
base {System.Threading.Thread} System.Runtime.ConstrainedExecution.CriticalFinalizerObject System.Threading.Thread}
ApartmentState MTA System.Threading.ApartmentState
CurrentCulture {de-AT} System.Globalization.CultureInfo
CurrentUICulture {de-DE} System.Globalization.CultureInfo
ExecutionContext {System.Threading.ExecutionContext} System.Threading.ExecutionContext
IsAlive true bool
IsBackground true bool
IsThreadPoolThread false bool
ManagedThreadId 2 int
Name null string
Priority Highest System.Threading.ThreadPriority
ThreadState Background System.Threading.ThreadState
Static members
Non-Public members

Jiri Cincura added a comment - 02/Jul/15 03:49 PM
Can you share a test case? No matter the # of iterations it's fine for me. Simple console app is enough.