I'm developing a Dynamics GP VS Tools AddIn and noticed an odd behavior.
I was trying to access the Dynamics Globals object properties to get the current company ID and system database name and store it in my Model object.
Controller.Instance.Model.GPCompanyDatabase = Dynamics.Globals.IntercompanyId;
Controller.Instance.Model.GPSystemDatabase = Dynamics.Globals.SystemDatabaseName;
I have these two lines in another project, so I copied them to my current project.
Intellisense recognized Dynamics.Globals and let me choose the two properties, but I was getting an error about type conversion to a string.
Since I have used these exact lines previously, I suspected something wasn't right with my current project.
I had a reference to Application.Dynamics, and I had this using statement:
Since Dynamics.Globals was being picked up by Intellisense, it seemed like my references were okay, but obviously something wasn't quite right.
Another odd thing I noticed was that if I typed a period after SystemDatabaseName or IntercompanyId, I wasn't getting an Intellisense pop up of options.
So something was wrong--clearly Visual Studio wasn't able to determine the data types for those properties. I was able to use String.Convert to bypass the error, but it bugged me. It seemed like there was some type of issue with my Application.Dynamics reference.
After checking my other code and trying various things, I finally stumbled across the solution.
I needed to add a reference to Microsoft.Dexterity.Bridge.
Once I added the Bridge reference, Intellisense stopped complaining about the type conversion, and I was able to get Intellisense values for SystemDatabaseName and IntercompanyId.
Only after looking at it again today did I realize that a big clue was staring right at me.
The error was indicating that it was a Dexterity Bridge data type, but I didn't think to look at that detail, and probably only in hindsight was this clue helpful. But it explains why Bridge is required, and now I know to reference both libraries!
Happy bug hunting!