mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
Users have been complaining about strange errors arising when using the OracleClient classes. I have tracked it down to the OciDefineHandle and OciDefineByPos calls, and OracleParameter handling of amanged objects by unmanaged code. Currently two of the parameters passed to the above OCI call are short variables. They are passed as "ref" fields as Oracle uses their address to put size and indicator data once the data is fetched. However, being defined as short means that they are eligible for being moved during garbage collection. Thus if that field is moved between the OciDefineByPos call and the fetch of the data then what Oracle is pointing to may no longer be variable. I'm thinking it may be better to define these fields as IntPtr and allocate them and retrieve their values via Marshal.ReadInt16. As for OracleParameter, it uses a managed object "indicator" that is also used in a similar way. This reference is replaced by a IntPtr and a get/set method to access the contents.