StrataFrame Forum

TargetParameterCountException when running the DDT via a c# application

http://forum.strataframe.net/Topic28892.aspx

By Cory Cookson - 11/2/2010

Hi all,

We have created a custom application which deploys a DDT package.  This has worked fine until the 1.7.3 upgrade.

The application does implement the ISynchronizeInvoke interface.

We are seeing that OnPreDeploymentScriptExecutionStarted gets fired off through the Invoke method (actually using a dynamicInvoke) and then a short time later Invoke is called again with an ErrorReached method.

Below is the error:

TargetParameterCountException
  Parameter count mismatch.


Source     : mscorlib

Stack Trace:
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at OHR.DeployDDT.DDTDeployment.Invoke(Delegate method, Object[] args) in C:\Projects\SYSTOC.NET\MAIN\Utilities\CommandLineDDT\OHR.CommandLineDDT\DDTDeployment.cs:line 642
   at MicroFour.StrataFrame.DBEngine.SQL.DatabaseMigrator.OnPreDeployScriptExecutionStarted(Object sender, EventArgs e)
   at MicroFour.StrataFrame.DBEngine.SQL.DatabaseMigrator.ExecutePreProfileScripts()
   at MicroFour.StrataFrame.DBEngine.SQL.DatabaseMigrator.EnsureDatabases()
   at MicroFour.StrataFrame.DBEngine.SQL.DatabaseMigrator.DeployMetaDataThread()



Any help you can give would be greatly appreciated.

-Cory
By Ivan George Borges - 11/2/2010

Hi Cory.

Isn't there any parameter being missed?
By Cory Cookson - 11/3/2010

Hi Ivan and thanks for the reply,

No we don't call anything directly at all.

It is called through the invoke method and hasn't changed in quite some time (except for the upgrade).

-Cory
By Ivan George Borges - 11/3/2010

Hi Cory.

Version 1.7.3 has introduced some new porperties and events. Some are the SkipPreDeploymentScripts and SkipPostDeploymentScripts, which allows the pre and post scripts to be excluded from execution. Just for testing purposes, have you tried setting these properties to avoid the execution during deployment? Maybe there could be something there.

And sorry for asking, but could you post the code where you are invoking the method?
By Cory Cookson - 11/16/2010

here is a code snippet but really it's just from the ISynchronizeInvoke interface implementation:

        public object Invoke(Delegate method, object[] args)
        {
            return method.DynamicInvoke(args);
        }

        public bool InvokeRequired
        {
            get { return true; }
        }
Returning InvokeRequired as true throws the error later when Invoke is called.
By Ivan George Borges - 11/17/2010

Working on it, Cory. Trying to check if changes on 1.7.3 demanded new params.
By Ivan George Borges - 11/17/2010

Cory, there were events that get raised, but they use the ISynchronizeInvoke to see if an invocation needs to take place. Are you passing over a SyncObject on the constructor of the DatabaseMigrator? That is why I asked for your code, since looking at it we would be less confused if you weren't using a sync object, as there wouldn't be a test determining whether the _SyncObj is null. But since you say it has been working, there is mostly likely a test elsewhere.

If you can't figure this out, write a simple sample that reproduces the behavior and we will look at it.
By Cory Cookson - 1/10/2011

At this time setting InvokeRequired to False has resolved the issue for us.

Thank you for your time looking at this.

-Cory