What are the challenges you face when working across database platforms? Take the survey

Referencing SDK for Trial

clamk123clamk123 Posts: 40
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:

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: format
   at System.String.Format(IFormatProvider provider, String format, Object[] arg
   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)

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.



  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    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. 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.
  • Options
    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).
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    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.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    As a test I installed Sql Compare 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.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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
  • Options
    Thanks! That fixed it completely. The licensing window pops up, so I can start my trial period.

    I appreciate your help.
Sign In or Register to comment.