Search code examples
c#wcfconnectionfirebird

Wcf with firebird, Transactions Critical


I got the following code on my app:

using (var dBconn = new FbConnection(str_conexion_Pymesoft))
        using (FbCommand fb = new FbCommand(sql, dBconn))
        try
        {
            dBconn.Open();
            List<DBParteTrabajoProyecto> miDBParteTrabajoReparacion = new List<DBParteTrabajoProyecto>();
            var reader = fb.ExecuteReader();
            while (reader.Read())
            {
                 doStuff...
            }
        }
        catch(Exception ex)
        {
            Log.WriteLine(""+ex);
        }
        finally
        {
            dBconn.Close();
            dBconn.Dispose();
        }

This code most of the time works fine, but if I try to call the method very fast, I get this error:

'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-131345628091236018): 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Transactions.resources\v4.0_4.0.0.0_es_b77a5c561934e089\System.Transactions.resources.dll' cargado. El módulo se compiló sin símbolos.
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Excepción no controlada</Description><AppDomain>/LM/W3SVC/2/ROOT-1-131345628091236018</AppDomain><Exception>        <ExceptionType>System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Referencia a objeto no establecida como instancia de un objeto
</Message><StackTrace>
  en FirebirdSql.Data.FirebirdClient.FbCommand.RollbackImplicitTransaction() en C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:línea 784
  en FirebirdSql.Data.FirebirdClient.FbCommand.Release() en C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:línea 824
  en FirebirdSql.Data.FirebirdClient.FbCommand.Dispose(Boolean disposing) en C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:línea 376
  en System.ComponentModel.Component.Finalize()</StackTrace><ExceptionString>System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
  en FirebirdSql.Data.FirebirdClient.FbCommand.RollbackImplicitTransaction() en C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:línea 784
  en FirebirdSql.Data.FirebirdClient.FbCommand.Release() en C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:línea 824
  en FirebirdSql.Data.FirebirdClient.FbCommand.Dispose(Boolean disposing) 
  en C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:línea 376
  en System.ComponentModel.Component.Finalize()</ExceptionString>        
</Exception></TraceRecord>

This error appears randomly. Sometimes in the second call, sometimes in the tenth call.


Solution

  • This is a known issue, that has already been fixed. Update to latest version of FirebirdClient and you should be good.