VO + C# DLL with both connecting to ADS

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
robert.pope
Posts: 12
Joined: Tue May 02, 2017 6:14 am

VO + C# DLL with both connecting to ADS

Post by robert.pope »

This is probably a bit of a long shot asking here, but I'll take my chances...

I'm running a VO application that imports some C# code via DLL. Both VO and C# are opening a connection to the same database in ADS (free tables / no data dictionary). VO is using DbServer classes and C# is mapped with Entity Framework and a connection string. The connection string is: metadata=aaa.csdl|aaa.ssdl|aaa.msl; provider = Advantage.Data.Provider; provider connection string= 'Data Source=.; CharType = ADS_OEM; DbfsUseNulls = False; LockMode = PROPRIETARY; ReadOnly = False; SecurityMode = IGNORERIGHTS; ServerType = REMOTE; Shared = True; ShowDeleted = False; TableType = CDX; TrimTrailingSpaces = True'

The problem I have is around both assemblies running within the same process space accessing the DB at the same time. Querying the database from C# seems to be killing VO's ADS connection. I get 5333's and invalid ads connection handles. VO works fine up until the C# query runs. For example if I run:

Code: Select all

               

Code: Select all

using (MYDB db = new MYDB())
                {
                    var res = from lines in db.MyTable
                                 where lines.MyColumn == xxxx
                                 select lines;
                    foreach (var line in res)
                    {
                            System.Diagnostics.Trace.WriteLine(line.yyyy);
                    }


                    return res;
                }

VO works fine up until that point. After that I'll get an exception when it tries to access the database on a DbServer that was opened prior to the call, and held open until afterwards. Any DbServer opened and closed prior to the call, or opened and closed after the call is fine. This bug only affects servers that remain open during the call.

Any ideas? I've been playing with Pooling=False and ConnectionHandle=<Connection I'm manually opening>, but I've had no luck as yet. I don't suppose any similar problems have been reported previously here?

I'm continuing to troubleshoot this problem. If I find any more clues I'll post them here too.
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

VO + C# DLL with both connecting to ADS

Post by robert »

Robert,
This sounds like the C# code closes the connection that was created by the VO process.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
robert.pope
Posts: 12
Joined: Tue May 02, 2017 6:14 am

VO + C# DLL with both connecting to ADS

Post by robert.pope »

It looks like disabling connection pooling was the solution to my problem. Leaving this here for anyone else who might have this problem in the future.

My app.config was being overwritten by another file with the same name later on, so it looked like it wasn't working :(
robert.pope
Posts: 12
Joined: Tue May 02, 2017 6:14 am

VO + C# DLL with both connecting to ADS

Post by robert.pope »

Yep, that's exactly what I was thinking too. The confusing part was that for entity framework, I don't have any code to open / close the connection. The provider (??) does all that for me.

I just figured it out though. It had to do with the connection pooling feature in ADS. I've now turned it off and all is good.
robert.pope
Posts: 12
Joined: Tue May 02, 2017 6:14 am

VO + C# DLL with both connecting to ADS

Post by robert.pope »

For anyone with this problem in future, just add Pooling = False to your provider connection string.

Mine now looks like this: connectionString="metadata=xxx.csdl|xxx.ssdl|xxx.msl; provider = Advantage.Data.Provider; provider connection string= 'Data Source=.; CharType = ADS_OEM; DbfsUseNulls = False; LockMode = PROPRIETARY; ReadOnly = False; SecurityMode = IGNORERIGHTS; ServerType = REMOTE; Shared = True; ShowDeleted = False; TableType = CDX; TrimTrailingSpaces = True; Pooling = False'"
Post Reply