Search code examples
vb.netwindows-servicesodp.net

ODP.NET Code Crashing on 4.121 but not 2.121 - Windows Service - CommandBehavior.CloseConnection


I have an issue with a Windows service where it was crashing when trying to dispose of a reader created this way:

 drOra = cmdOra.ExecuteReader(CommandBehavior.CloseConnection)

The dispose was in the Finally block, checking for null

 If Not drOra Is Nothing Then drOra.Dispose()

Even when I placed it into a catch itself, the windows service still crashed.

So, I modified to use a USING statement, and now that block crashes.

I temporarily fixed it by using ODP.NET version 2.121 instead of 4.121, but was hoping for insight on why such a crash occurs. I cannot get output because its not going to the catch block.

It's the non-managed provider.


Solution

  • I refactored the code to close connections and adapters properly and removed the CommandBehavior.CloseConnection references.

    Once I did that, everything began to work properly.