Issue Details (XML | Word | Printable)

Key: DNET-755
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Marcos R. Weimer
Votes: 0
Watchers: 0
Operations

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

System.IndexOutOfRangeException

Created: 20/Apr/17 02:00 PM   Updated: 08/May/17 02:38 PM
Component/s: ADO.NET Provider
Affects Version/s: 5.8.1.0
Fix Version/s: 5.9.0.0

Environment:
Framework 4.0 / Firebird 3.0.2.32703 / Visual Studio 2015
Occurs eventually in windows 10 Pro/Enterprise / Windows 7 Enterprise


 Description  « Hide

        public void DisparaEvento(string evento)
        {
            using (FbCommand q = conexao.CreateCommand())
            {
                q.CommandType = CommandType.Text;
                q.CommandText = "execute block as begin POST_EVENT '" + evento + "'; end";
                q.ExecuteNonQuery(); <------------ Exception here
            }
        }

Multiple calls in a row...

DisparaEvento("EnviarNF");
DisparaEvento("ReciboNF");
DisparaEvento("CancelarNF");
DisparaEvento("DownloadNF");
DisparaEvento("ConsDestNF");
DisparaEvento("NFSe");

eventually:

An unhandled exception of type 'System.IndexOutOfRangeException' occurred in FirebirdSql.Data.FirebirdClient.dll

Stack:
   em FirebirdSql.Data.Common.StatementBase.ProcessStatementTypeInfoBuffer(Byte[] buffer)
   em FirebirdSql.Data.Client.Managed.Version11.GdsStatement.Prepare(String commandText)
   em FirebirdSql.Data.FirebirdClient.FbCommand.Prepare(Boolean returnsSet)
   em FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
   em FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteNonQuery()
   em UltraNFe.EventosFB.DisparaEvento(String evento) na C:\ultra\UltraNFe2\EventosFB.cs:linha 100
   em UltraNFe.EventosFB.DispararEventos() na C:\ultra\UltraNFe2\EventosFB.cs:linha 110
   em UltraNFe.FPrincipal.btnAutomatico_Click(Object sender, EventArgs e) na C:\ultra\UltraNFe2\Form1.cs:linha 506
   em UltraNFe.FPrincipal.Form1_Shown(Object sender, EventArgs e) na C:\ultra\UltraNFe2\Form1.cs:linha 195
   em System.Windows.Forms.Form.OnShown(EventArgs e)
   em System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   em System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   em System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   em System.Windows.Forms.Control.WndProc(Message& m)
   em System.Windows.Forms.Form.WndProc(Message& m)
   em System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   em System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   em System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   em System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   em System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   em UltraNFe.Program.Main() na C:\ultra\UltraNFe2\Program.cs:linha 64
   em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   em System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   em System.Threading.ThreadHelper.ThreadStart()

Not ocurred in Firebird 2.5.7.27050 with FirebirdSQL.Data.FirebirdClient 2.7.7.0


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Marcos R. Weimer added a comment - 03/May/17 01:40 PM - edited
Eventual InvalidCastException during receive events...

<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&lt;/TraceIdentifier&gt;&lt;Description&gt;Exce&#xE7;&#xE3;o não tratada</Description><AppDomain>UltraNFe.vshost.exe</AppDomain><Exception><ExceptionType>System.InvalidCastException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Não é possível converter um objeto do tipo 'FirebirdSql.Data.Client.Managed.SqlResponse' no tipo 'FirebirdSql.Data.Client.Managed.GenericResponse'.</Message><StackTrace> em FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.QueueEvents(RemoteEvent events)
   em FirebirdSql.Data.Common.RemoteEvent.EventCounts(Byte[] buffer)
   em FirebirdSql.Data.Client.Managed.Version10.GdsEventManager.ThreadHandler(Object _)
   em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   em System.Threading.ThreadHelper.ThreadStart(Object obj)</StackTrace><ExceptionString>System.InvalidCastException: Não é possível converter um objeto do tipo 'FirebirdSql.Data.Client.Managed.SqlResponse' no tipo 'FirebirdSql.Data.Client.Managed.GenericResponse'.
   em FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.QueueEvents(RemoteEvent events)
   em FirebirdSql.Data.Common.RemoteEvent.EventCounts(Byte[] buffer)
   em FirebirdSql.Data.Client.Managed.Version10.GdsEventManager.ThreadHandler(Object _)
   em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   em System.Threading.ThreadHelper.ThreadStart(Object obj)</ExceptionString></Exception></TraceRecord> 7.01s

Jiri Cincura added a comment - 06/May/17 07:21 PM
I can't test it, because you haven't provided any code. But I think it's fixed in above mentioned version.

Marcos R. Weimer added a comment - 08/May/17 02:38 PM
code in first description...
[quoted]
 public void DisparaEvento(string evento)
        {
            using (FbCommand q = conexao.CreateCommand())
            {
                q.CommandType = CommandType.Text;
                q.CommandText = "execute block as begin POST_EVENT '" + evento + "'; end";
                q.ExecuteNonQuery();
            }
        }

Multiple calls in a row...

DisparaEvento("EnviarNF");
DisparaEvento("ReciboNF");
DisparaEvento("CancelarNF");
DisparaEvento("DownloadNF");
DisparaEvento("ConsDestNF");
DisparaEvento("NFSe");
[quoted]

- I'm testing at 3 o'clock.
- seems to have solved the problem using framework 4.5.2 and Dll in version 5.9.0.0
- once you have a warning advice.
Thank you