Referencing SDK for Trial

Automate and integrate using the SQL comparison API

Moderators: Chris Auckland, David Atkinson, Michelle Taylor, chengvoon.tong

Referencing SDK for Trial

Postby clamk123 » Sun Apr 01, 2012 6:16 am

I've been wanting to try out the SQL Comparison SDK, and have been having issues.

I reference the components as per the documentation and it compiles fine.

When I execute the code, it gets to any Redgate object (such as Database) that invokes licensing, and it pops up the Licensing window (the one where you can activate the product, or "skip" it for a 14 day trial).

I choose skip and immediately get the below error:


[code]Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: format
at System.String.Format(IFormatProvider provider, String format, Object[] arg
s)
at RedGate.SQLToolkit.Engine.Licensing.ToolkitLicenceProvider.GetLicense(Lice
nseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseCont
ext context, Type type, Object instance, Boolean allowExceptions, License& licen
se, String& licenseKey)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at RedGate.SQLCompare.Engine.Database..ctor()
at Program.Program.Main(String[] args)[/code]


I don't have a license to activate it (haven't decided if this is useful to code the API directly) but I just can't get the SDK to work by using the SKIP option.

I've tried Windows XP, Windows 7, formatted and resintalled a dev computer, tried every single .net Framwork and service pack, multiple versions of Visual Studio 2010/2008. The above example was written in notepad to remove possible VS issues. I've compiled under .net 2.0, 3.0, 3.5, 4.0.

I've tried adding licenses.licx files and played with it, even manually licensing the code itself.

But no matter what, the above error persists whenever it touches a object with the Licensing attribute on it.

I'm sure I've done massive overkill in debugging this. I've looked through all the requirements for MDAC, .net, OS, that is listed for this product, but I cannot find a way to make it work.

I'm sure it's something simple that's I've screwed up, I'd love to know what it is.

Thanks.
clamk123
 
Posts: 28
Joined: Sun Apr 01, 2012 5:24 am

Postby Brian Donahue » Mon Apr 02, 2012 4:33 pm

Looks like one of those annoying .NET resource problems. Are you building your application against .NET 2,3,or 4? It's trying to get some text out of the embedded resources in the SQLCompare.Engine dll and not finding them - I am guessing because they are in a resx compatible with .NET 2 and 3.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby clamk123 » Mon Apr 02, 2012 6:02 pm

I tried compiling it as just a standard console application.

1) Reference the RedGate.Shared.SQL, RedGate.Shared.Utils, and RedGate.SQLCompare.Engine (I also reference System.Web as some components internally reference it), from the Sql Comparison SDK/assembly folder from the SDK install.

2) In code, create an instance of the Database class.

3) On execution, it pops up the licensing window, I choose "Skip".

4) Above exception is thrown, with the "null" issue with the format parameter.

RedGate.SQLCompare.Engine (v. 10.0.0.192) appears to be targeting framework (v2.0.50727). I've targeted my executable to target .net 2.0, 3.0, 3.5, 4.0, and each time I get the same above error.

I've also added references to everything in the assembly folder (.Rewriter, .Licensing, .ASTParser) in case there was a dependency there, but has not resolved the exception.
clamk123
 
Posts: 28
Joined: Sun Apr 01, 2012 5:24 am

Postby clamk123 » Mon Apr 02, 2012 6:18 pm

As an addendum, I've also added a licenses.licx as an embedded resource as a test. It pops up the license/skip window as before, however this is at compile time, not run time. I choose skip, and it continues without an error.

When I attempt to execute the line of code that creates an instance of the Database class, it doesn't prompt for licensing, but the exception pops up immediately (null for format parameter).
clamk123
 
Posts: 28
Joined: Sun Apr 01, 2012 5:24 am

Postby Brian Donahue » Mon Apr 02, 2012 6:18 pm

Ok, I have logged a bug for this. I don't think the strings that need to be displayed when the trial expires are avaulable in the form's resources.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby clamk123 » Mon Apr 02, 2012 7:07 pm

Is it that it's trying to display that the trial time period has expired? Or is it just preloading that information to display to the user if the trial has expired?

I only ask because this was recently loaded onto a dev box that's never used it before, and the window still states its under a 14 day trial (we've never actually been able to trial it, so I don't know if it should be decrementing time at this point or how your internal licensing works).

But I appreciate you listing it as a bug, we've tried it several different ways and just can't figure out what we're doing wrong.
clamk123
 
Posts: 28
Joined: Sun Apr 01, 2012 5:24 am

Postby Brian Donahue » Tue Apr 03, 2012 9:07 am

It's conditionally trying to load the string for either "trial has expired" or "trial will expire". Strange thing is you're the only person who has reported it so far and it looks to me like it should affect everybody.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby clamk123 » Wed Apr 04, 2012 5:40 pm

As a test I installed Sql Compare 8.50.25.11 and implemented the exact same code with the API from that version.

The Database object is created, the licensing/trial popup lets me choose activate or skip, after skip is chosen, the code continuesto run (with the trial popup message box popping up) and the test code "works".

So it seems that I can get the older version to work, but I still can't get Sql Comparison SDK 10 to work without that weird licensing window exception.
clamk123
 
Posts: 28
Joined: Sun Apr 01, 2012 5:24 am

Postby Brian Donahue » Wed Apr 04, 2012 5:59 pm

Yes, that's correct. SDK 10 has a bug in it. I am trying to get someone to look at it as a matter of urgency.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby Brian Donahue » Mon Apr 09, 2012 12:54 pm

Please try the following update for SDK 10.0 - it should fix the crash but more than likely it will come up and tell you that the trial has expired.

ftp://support.red-gate.com/patches/sql_ ... .0.111.zip
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby clamk123 » Mon Apr 09, 2012 4:06 pm

Thanks! That fixed it completely. The licensing window pops up, so I can start my trial period.

I appreciate your help.
clamk123
 
Posts: 28
Joined: Sun Apr 01, 2012 5:24 am


Return to SQL Comparison SDK 10

Who is online

Users browsing this forum: No registered users and 0 guests