I am using version 2.7.7 of the Firebird .NET Provider because I have to
support an application running on .NET 2.0.

I finally found the root of this error that can cause any application to
crash, even if the application handles unhanded exceptions.
This error might appear also and in other versions of the provider as other
users have reported here:
http://tracker.firebirdsql.org/browse/DNET-316and might also be
related with bugs reported here:
http://tracker.firebirdsql.org/browse/DNET-386 and here:
http://tracker.firebirdsql.org/browse/DNET-382

The exact place where the exception is raised is on *line: 835 of
FbCommand.cs.*
You can download the source code from this link:
http://sourceforge.net/projects/firebird/files/firebird-net-provider/2.7.7/.
Choose the
*NETProvider-2.7.7-src.7z*
 file.

On this line the code is:
*this.connection.InnerConnection.RemovePreparedCommand(this);*

The exception is raised when the InnerConnection is null.
There is a check for null before this line but not for
this.connection.InnerConnection.

The existing code is this:
*// Remove the command from the Prepared commands list*



*if (this.connection != null && this.connection.State ==
ConnectionState.Open)    {
this.connection.InnerConnection.RemovePreparedCommand(this);    }*


What we have to add to avoid the null reference exception is a check for
null on *this.connection.InnerConnection* so the code should look like this:
*// Remove the command from the Prepared commands list*
*if (this.connection != null && this.connection.State == ConnectionState.Open
&& this.connection.InnerConnection != null*
*)*
*    {*

*     this.connection.InnerConnection.RemovePreparedCommand(this);    }*

After making this change I deployed my app on a test environment and left
it running for 10+ days. Everything looks fine until now and the exception
a had before is gone. Before this change my app was crashing after around
24 hours.

Can somebody merge this change on source forge, also targeting .NET 2.0?  I
am sure that many people will benefit from this small change because it
will improve the stability of the provider and this is very important.

If this is not possible can you tell me how to correctly build the source
code of 2.7.7 on VS 2010 targeting only .NET 2.0?

Thanks in advance
Yiannis
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to