This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- DotNetCoCreateObject : Invalid number of parameters.
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
May 10, 2011
04:56 PM
DotNetCoCreateObject : Invalid number of parameters.
In my Basic MSI project,
I used DotNetCoCreateObject in the installscript to instanciate my Installhelper.dll and then call a method in it.
Everything works fine , until
I declare 2 methods or more with the same name but different parameters in the installhelper.dll.
Then during the installation , the call to the method with different parameters does not work it gives error -2147352562 : Invalid number of parameters.
If I give a different method name, then it works.
Is there a limitation that you cannot declare more than one method with the same name?
I used DotNetCoCreateObject in the installscript to instanciate my Installhelper.dll and then call a method in it.
Everything works fine , until
I declare 2 methods or more with the same name but different parameters in the installhelper.dll.
Then during the installation , the call to the method with different parameters does not work it gives error -2147352562 : Invalid number of parameters.
If I give a different method name, then it works.
Is there a limitation that you cannot declare more than one method with the same name?
(1) Reply
May 19, 2011
02:02 PM
The is more likely an issue with the COM support that allows for calling COM objects or .NET assemblies in InstallScript. The InstallScript engine works with COM through the use of IDispatch. IDispatch::GetIDsOfNames is used to find the dispatch ID of the given method/property name on an object. The GetIDsOfNames method does not provide any way to differentiate multiple methods with the same name (and normally this is implemented by returning the first match with typelibrary information to the requested method name). As such, IDispatch (and COM) don't really support method overloads.
If this assembly was registered for COM interop and then a VBScript with roughly the same code was run, the same behavior would likely be seen.
As a workaround, using different method names is recommended. As an alternate approach, a Managed Custom Action can be used (in MSI projects) to call a method in a .NET assembly. This functionality works differently to how InstallScript supports .NET assembly calls and may provide more flexibility in this specific case.
If this assembly was registered for COM interop and then a VBScript with roughly the same code was run, the same behavior would likely be seen.
As a workaround, using different method names is recommended. As an alternate approach, a Managed Custom Action can be used (in MSI projects) to call a method in a .NET assembly. This functionality works differently to how InstallScript supports .NET assembly calls and may provide more flexibility in this specific case.