Autodesk Inventor Add-In does not load - vb.net

I have Autodesk Inventor 2012 and its SDK, including add-in creation wizards, installed. I have created an add-in project (in VB.NET), and used the code from SimpleAddIn sample provided. .addin file points to the location of dll output of the compilation.
However, i have run into a following problem. When Inventor loads, not a single breakpoint in the add-in Activate function is triggered. Moreover, when i call the list of add-ins, mine is shown in the list as not loaded, and however i flag it to be, it does not.
What could be the reason for this behaviour? How can that be fixed?

Well, I assume that you're using RegistryFreeAddins being deployed via Manifests...
From the fact that your AddIn is listed in the AddIn Manager, I conclude that the registration works, but the loading at runtime fails. This can have those main reasons:
Missing Dependencies (in case you use third party assembiles)
BadImageFormatException (your AddIn compiled in x86 and you have X64
Inventor installed, which you always have in case you've got a 64-bit
OS)
Have a look at your debug output in VisualStudio. Do you see any Exception Messages, that would relate to your AddIn? If not, you could try to activate the "Managed Debugging Assistants" in VS (especially for BadImageFormat- and FileNotFoundException(s)). Just google the above phrase to see how it's done.
Hope I could help :)

Are you targeting .Net 4? Inventor 2012 supports only .net 3.5 it seems. I ran into the same problem and changing to 3.5 made my plugin load correctly.
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Registry-free-addin-won-t-load/td-p/3488178

if for a reason or another, the library load crash in the Activate procedure, you will not be able to debug the solution.
So, clean the Activate sub and keep only necessary calls and try again.
If it's still not working, just PM me the Activate procedure and I'll help you.

Related

VSTO File Not Found

I am putting together a VSTO addin for MS Outlook. The addin is designed to utilize a unmanaged C++ library. Access to the library is via a C++/CLI (CLR) project. I am receiving a
File Not Found
error when running the ADDIN directly. It appears that the addin has difficulty with the associated unmanaged C++ library. The library is completely packed within the C++/CLI project and nothing using it requires knowledge of the unmanaged C++ library. The strangest aspect of this situation is that If I launch the ADDIN from Visual Studio all is loaded properly. I've validated that all libraries being used are where they are suppose to. It is unclear to me why the addin would fail to launch (when not being launched from Visual Studio).
Note: I validated this by running a test where I created a C++ library with one class and a C++/CLI library with one class that instantiates the class from the first library. I attempt to connect to the C++/CLI library from a VSTO project. I get the file not found error. I felt this was the simplest test to validate / determine what was happening.
Peter
Peter
The issue dealt with my making assumptions based on where things were placed. I had an installer that deployed the addin to the target deploy location. All files went into this folder. MY thinking was that if all the libraries are located within the same location they should all be found. This was based on the my thinking that an app runs and looks locally first for files. My mistake was that the app being run was Office Outlook - and it runs in a specific folder location. When I got the file not found I was thinking this can't be because the files are all together. BUT Office products when loading ADD Ins do not look in the location that the Add In is identified to be in (at leat for un managed DLLs - managed -- maybe different).
The end result was that the unmanaged DLL was not locatable because it did not show up in any of the seath locations of Windows. So the correct was to update the path to have the location of that add in. Which solved the issue of not found. What is annoying is that Visual Studio debugger -- looks to be working on the aspect of identifying DLLs where the application is being launched from. Which in general is fine -- except with VSTO the app being run is somewhere else -- but VS still looked in the project folder location to find the files. Making it somewhat unclear. This should not be occurring. VS debug should try or at least be configurable to operate in the context of the real world scenario. If it does -- I certainly was not able to find that configuration.
Peter

OneNote 2013 Add-in won't load. How to debug?

I'm following the excellent tutorial by Malte Ahrens on how to create a OneNote add-in.
Initially I followed it step by step, making a few changes (just renaming the class, and using my own name and GUID in the assembly) info. As I'm using VS2012 and am not yet ready to hand-roll a WiX installer I manually copied over the built dll to the correct place and also created a registry file to make the requisite entries. I confirmed that they were all there, loaded up OneNote but no add-in, going to "mange COM addins" section I saw the following error:
Load Behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in.
I spent some time debugging this but didn't get very far. So this afternoon I decided to start again but copy his code verbatim. I simply downloaded the example project, used the trial of Vdproj to Wix to create the installer and built everything.
I get the exact same error.
Why is this please? What does this mean and most importantly how do I debug the problem?
A few specifics about my environment and where it may differ from the original tutorial.
I am running Office 2013 AND it's 64bit. His tutorial is for 2010. This means when I loaded up the demo solution I had to remove the non-existent reference to the Onenote 14 Interop and add the v15 version.
In terms of registry entries they go to the right place, not the WOW6432 registry nodes. I doubly know this as if I load up OneNote and then refresh the HKCR registry node for the add-in, the LoadBehavior switches to 0x00000002, (disabled).
Other things that may be worth noting.
I have enabled OneNote logging and it's quiet on my issue.
There are 2 other posts on here with a seemingly similar problem (but Office 2010) here and here, neither got a response. The first guy had it loading once, but then had to manualy start it each time, mine never loads (and I've not signed my assembly) the second guy never got a response.
As I say, even knowing how to debug this further would be a great step forwards.
Edit:
I've gone back to debugging my own version, which is almost identical anyway as I'm not sure what the installer is actually doing and I think because it's a demo of the wix converter it's only allowing me to build for x86.
If I add OneNote.exe under "start external program" and run debug on my add-in, I see the following lines appear when I try and tick the add-in under "manage COM add-ins" within OneNote. I'm afraid I'm still pretty green at all this so I'm not sure what it means.
First-chance exception at 0x00007ffe4f86ab78 in ONENOTE.EXE: 0x800401FD: Object is not connected to server.
First-chance exception at 0x00007ffe4f86ab78 in ONENOTE.EXE: 0x800401FD: Object is not connected to server.
First-chance exception at 0x00007ffe4f86ab78 in ONENOTE.EXE: 0x800401FD: Object is not connected to server.
Also, since reading up more I think me simply copying my dll into the install folder program files\[manufacturer]\[application] (as I don't have an installer) was not enough. I've now executed this against my dll
PS C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319> .\RegAsm.exe
and it came back with
Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.33440
for Microsoft .NET Framework version 4.0.30319.33440
Copyright (C) Microsoft Corporation. All rights reserved.
Types registered successfully
Is there anything else I should be doing to register the dll correctly?
Enable logging for OneNote 2013:
Create a file "EnableOneNote2013APILogging.reg"
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\OneNote\Options\Logging]
"EnableLogging"=dword:00000001
"EnableTextFileLogging"=dword:0000001
"ttidLogObjectModel"=dword:00000001
"ttidLogObjectModelAddins"=dword:00000001
Create a file "DisableOneNote2013APILogging.reg"
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\OneNote\Options\Logging]
"EnableLogging"=dword:00000000
"EnableTextFileLogging"=dword:0000000
"ttidLogObjectModel"=dword:00000000
"ttidLogObjectModelAddins"=dword:00000000
This is based on http://blogs.msdn.com/b/descapa/archive/2006/12/08/debugging-the-onenote-api-enable-logging.aspx but you need to add EnableTextFileLogging ;-).
The logfile is created in %temp%\OneNote.log
For OneNote 2010 change the path in the .reg files to \14.0\ instead of \15.0\

Strong name validation failed on VB.NET Assembly

I have a VB.Net 1.1 application works just fine after compiling in Visual Studio. However, I want to use ILMerge to combine all the referenced assemblies into a single executable just to make it easier to move around. After I send it through ILMerge and try to run it I get the error
"Strong name validation failed for assembly.exe" .....
But none of my stuff is strong named! I saw this post here: Strong Name Validation Failed and tried running it through 'sn.exe -Vr merged.exe' but that gives me this error:
"merged.exe does not represent a strongly named assembly"
Has anyone else had this problem before? How do I fix it?
UPDATE:
I'm starting to feel like Strong name validation isn't the real problem here. I'm building against .NET v1.1 and running on a machine where that is the only .NET version installed (happens to be Windows 2003). The merged executable appears to die with that error on every Windows 2003 machine I try, but if I try to run it on a more modern OS (Vista) it at least starts, but that's not really a good test since the environment isn't fit for a real test.
I have verified that my app.config has the correct settings (specifying required and supported runtime version of v1.1.4322)
I use the /targetplatform:v1.1 option when running my assemblies through ILMerge.
ILMerge is definitely causing the problem (i.e. it works fine before I merge), I just don't know how to fix it.
I had to find and download a very old version of ILMerge (v1.1) in order for my merged binary to work; there must be a bug in the way the current ILMerge application builds .NET 1.1 assemblies. Thankfully we had one internally because I would probably have never found it online.

ActiveX component can't create object

I have just installed a third party app on my Windows Server 2008 server
and I get the
ActiveX Component can't create object
message when I try to access using a CreateObject in VBScript.
It is definitely installed and exists under "Programs and Features". Does anyone have a list of things that I can check to figure out what is going on?
I have now tried to register the DLL using regsvr32.exe /i bob.dll as suggested but I get this error:
The Module "Bob.dll" was loaded but the entry-point DllRegisterServer was
not found.
Make sure that "Bob.dll" is valid DLL or OCX file and then try again.
I should note that this is a 32-bit application on a 64-bit machine at
this point. It also works fine on my machine which is Windows XP 32-bit.
It turns out to get this application working under VBScript, I had to do two things.
Run RegAsm.exe to register the DLLs.
Run the C:\Windows\SysWOW64\cscript.exe to run my VBScript.
If these don't work, check out the other answer here about enabling 32-bit applications in IIS.
It's also worth checking that you've got "Enable 32-bit Applications" set to True in the advanced settings of the DefaultAppPool within IIS.
The app is trying to create a COM Object and even if that COM DLL exists, it may depend on another DLL which isn't installed. You can use DependencyWalker to find out if this is the case.
Check your browser settings.
For me, using IE, the fix was to go into Tools/Internet Options, Security tab, for the relevant zone, "custom level" and check the ActiveX settings. Setting "Initialize and script ActiveX controls not marked as safe for scripting" to "Enable" fixed this problem for me.
Also when you register the component make sure you use the 32-bit version of regsvr32.exe.
If you simply run regsvr32.exe in a elevated prompt, it will default take the standard 64-bit version (which oddly enough is located in C:\Windows\System32)
The version I believe you need is located in C:\Windows\SysWow64\regsvr32.exe
It really looks as though the object you are referencing is not registered on the system. I know you said it's installed, but that doesn't necessarily mean it's registered. To confirm this, search for the progID that you used in your registry.
Example for this code:
set objFSO = CreateObject("Scripting.FileSystemObject")
I would search for Scripting.FileSystemObject in the registry. Then I would look at registry key above the found value, for InProcServer32 value. This will give you the path to the ActiveX file that it was registered from (for Scripting.FileSystemObject the file is "c:\windows\system32\scrrun.dll").
If you can't find your progID in the registry, then it's not registered on your system which is your problem. If it's not registered you need to find out what file registers it, which is usually an .ocx or a .dll in the same folder path of your third party app, and then register these file(s). Here is the command to register a file:
regsvr32 /i "c:\windows\system32\scrrun.dll"
Even if you find the progID value in the registry and it references a file that is present on your system, you may still want to try re-registering the file. I have found that sometimes the registration got broken somehow somewhere and it was easier to re-register the files then it was to fix the issue.
If its a 32 bit COM/Active X, use version 32 bit of cscript.exe/wscript.exe located in C:\Windows\SysWOW64\
I know this is an old thread, but has anyone checked if their Antivirus is blocking Win32API and Scripting on their systems? I have CylanceProtect installed on my office system and i found the same issues occurring as listed by others. This can be confirmed if you check the Windows Logs in Event Viewer.
I also meet the same error in vbscript.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Solution:
Open command line, run :
regsvr32 /i "c:\windows\system32\scrrun.dll"
and it works
I've had the same issue in a VB6 program I'm writing, where a Form uses a ScriptControl object to run VBScripts selected by the User.
It worked fine until the other day, when it suddenly started displaying 'Runtime error 429' when the VBScript attempted to create a Scripting.FileSystemObject.
After going mad for an entire day, trying all the solutions proposed here, I began suspecting the problem was in my application.
Fortunately, I had a backup version of that form: I compared their codes, and discovered that inadvertently I had set UseSafeSubset property of my ScriptControl object to True.
It was the only difference in the form, and after restoring the backup copy it worked like a charm.
Hope this can be useful to someone. Up with VB6! :-)
Max - Italy
I had the same issue with Excel, I was trying to use a 32 COM DLL with an Excel 64 bits version and I got this error. I rebuild the COM dll to a 64 bits version and the error disappears. So be sure that your COM dll has the same architecture (x86 vs x64) than your application.
I had this problem too. I was trying to run an old 32-bit dll in a 64 bit system. I got it working by copying the .dll to the C:\Windows\SysWoW64\ directory and running this:
%systemroot%\SysWoW64\regsvr32 "C:\Windows\SysWoW64\thenameofyourdll.dll"
And also enabling IIS to run 32 bit apps

Problems adding a COM component reference to a VB.NET project

I have a third party COM dll that I'm trying to add to a vb.net (2008 express) project. I put the dll in C:\WINDOWS\system32\ and registered it with "regsvr32 vxncom.dll". When I go to projects > add reference and go to the COM tab it shows up in the list of available components/libraries. But, when I select the library and hit ok, visual studio complains: "A reference to 'vxncom 4.0 Library' could not be added. Could not register the ActiveX type library 'C:\WINDOWS\system32\vxncom.dll'."
The project I am doing this in is an example provided by the folks who distribute the dll. The component also fails to be added when I start a new (blank) vb.net project.
UPDATE 1:
I ran dependency walker on the dll in question and here's what I got in the error log:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
The module in question seems to be libeay32.dll, but it already exists in C:\WINDOWS\system32.
UPDATE 2:
I went to the openssl site and downloaded and used their installer to update the libeay32.dll. I ran dependency walker again on vxncom.dll, and there were no errors. Went back to visual studio and it still didn't want to add the reference. Exact same error as before.
Maybe the DLL VB is trying to register depends on another DLL that is not present. You can confirm this (or rule it out) by using the free Dependency Walker tool from http://www.dependencywalker.com/
RESPONSE TO UPDATE 1:
Sounds like there's a mismatch between the version of libeay32.dll that's installed on your system and the one that your component is expecting -- depends is saying that your component is looking for a function that isn't there. I would check the version number of libeay32 and then contact the vendor and ask them what versions they support.
Just a thought - you may get a more detailed error message if you create your own PIA using tlbimp.exe, rather than relying on the IDE to do it for you.
Assuming you haven't fixed it or have moved on to alternatives; and following on from jeffm's answer is libeay32.dll properly registered with the operating system? Re-installing / repairing usually fixes that type of problem (I see it a lot with MS Office and MapPoint where the COM objects occasionally unregister themselves for one reason or another.)