Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException [DNET617] #578

Closed
firebird-automations opened this issue Jun 29, 2015 · 12 comments
Closed

NullReferenceException [DNET617] #578

firebird-automations opened this issue Jun 29, 2015 · 12 comments

Comments

@firebird-automations
Copy link

Submitted by: Rand Random (rand.random)

Is related to DNET619

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)

@firebird-automations
Copy link
Author

Commented by: @cincuranet

It's impossible to be only this line. Somebody needs to call this method.

@firebird-automations
Copy link
Author

Commented by: Rand Random (rand.random)

Here a screenshot of the message:
http://oi59.tinypic.com/2wncp38.jpg

@firebird-automations
Copy link
Author

Commented by: @cincuranet

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.

@firebird-automations
Copy link
Author

Commented by: Rand Random (rand.random)

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.

@firebird-automations
Copy link
Author

Commented by: @cincuranet

For sure you should dispose the commands. Does the NRE happen on finalizer thread?

@firebird-automations
Copy link
Author

Commented by: Rand Random (rand.random)

How would I check this?

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Well, check on what thread the exception was thrown.

@firebird-automations
Copy link
Author

Commented by: Rand Random (rand.random)

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

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Can you share a test case? No matter the #⁠ of iterations it's fine for me. Simple console app is enough.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue is related to DNET619 [ DNET619 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: vNext [ 10704 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants