Is a COMException of 0x80040154 always 'Class not registered'? - 64-bit

Does a System.Runtime.InteropServices.COMException of 0x80040154 always mean that the class isn't registered? I'm getting a COMException which says "Retrieving the COM class factory for component with CLSID {29131539-2EED-1069-BF5D-00DD011186B7} failed due to the following error: 80040154." It's trying to load Interop.Domino.dll which is a reference I got from the COM tab of Add Reference called "Lotus Domino Objects" which points to domobj.tlb in the Notes program folder.
I wrote the code years ago - it's the only thing I've ever done with interop and it's fair to say that I never really got to grips with it.
I'm seeing this error again after moving the code to a 2008 R2 server (so it's x64). It was written on XP and run on 2003 (both x86). In order to diagnose the problem, I built a Win7 x86 (because there's no R2 x86) box and it worked. I also built a 2003 x64 box and it fails with the same error, so it looks like it's caused by moving to x64 architecture. Is there something I should do when doing interop to get x86 COM DLLs to work on x64 machines?

I had the same problem trying to build and run a .NET application on Windows 7 x64 that called interop.domino.dll, which is 32 bit only.
To resolve, I recompiled the .NET application to run specifically as x86 when run on x64 operating systems.
I was using Visual Studio 2010 Express Edition which is trickier to target specifically for x86 platforms than the paid for versions.
The solution was:
Click TOOLS > OPTIONS > PROJECTS AND SOLUTIONS
Check the box "Show advanced build configurations" and click OK
Click TOOLS > SETTINGS > check EXPERT SETTINGS to see the build configuration manager
Click BUILD > CONFIGURATION MANAGER select the platform dropdown to X86 and click CLOSE
Now rebuild the project

Pay attention to register of 32-bit components using the correct register (C:\Windows\SysWOW64\regsvr32.exe).
If you have already registered up with the 64-bit version, unregister each dll with the same version.
More help you find here Team is Going from XP32 to XP64 for .NET Development - Any Gotchas?
Good luck

There's an IBM technote that indicates that the Domino COM classes are not supported on a 64-bit OS. See https://www-304.ibm.com/support/docview.wss?uid=swg21454291 So it seems like even by compiling the code to run as x86 (as per mpownie's answer), you're still taking some chances.

Related

Visual Studio 2015 unrecognized error in Windows Web Services Framework

I see the following error with Visual Studio 2015 (Tried both community and professional edition).
Wrote a simple Visual C++ CosoleApplication which has "printf("Hello World\n");".
Debug with Platform "x86" Compile and step through Works.
Debug with Platform "x64" Compiles but when it runs it throws this error.
Code is simple with following lines:
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main()
{
printf("Hello World \n");
return 0;
}
My desktop has following configuration:
OS: Windows 7 Enterprise 64-bit version
Anti-Virus: McAfee Anti-virus software running; Can't disable that.
Firewall: ON (Can't disable that for security)
Question: Stepping through the code with (Debug x86 platform) works. Why "Debug x64 platform" does NOT work ?
Any suggestion would be helpful.
Thanks
gshant
I was having the same trouble. This is what I did.
Go to Project, Project properties.
Select Application Tab and make note of what framework you are using. For me it was 4.5.2.
Use the pull down to select a different Framework. At the bottom there is an option to install additional Frameworks.
After the web page opens, select the Framework you previously noted and download the Development Pack.
Close Visual Studio and install the Development Pack.
This worked for me when I selected x64.
Hope this helps you.
Make sure you have both the x86 and x64 .NET Core runtimes installed.
https://www.microsoft.com/net/download/windows
This answer deals with using IIS 7 to debug. I have not checked it with IIS Express.
If your web application is 32-bit (x86), you need to run IIS Manager and:
Look at the "Basic Settings" of your web site. Check what IIS
application pool your project is using.
Look at the "Advanced Settings" of this application pool and ensure
that "Enable 32-bit applications" is True.
This was a firewall issue for me. I'm not sure the exact root cause, but I found stopping my firewall resolves this. If I find the exact root cause, I'll update my answer so firewall exception rules can be written.
I believe the issue is when you are debugging it is actually using the remote debugger still under the hood (connecting x86 Visual Studio to an x64 process, etc) and a firewall can block this.
The solution for me was to go:
Project -> Properties -> Build -> Prefer 32-bit enabled
with Platform target -> "Any CPU".

Error running app on Windows Phone 8.1 emulator - A dependent dll was not found

I have universal project targeting Windows Store 8.1 and Windows Phone 8.1 platform.
The windows one works fine but I having trouble running the WP one on an emulator. I get the error message saying:
Microsoft Visual Studio Unable to activate Windows Store app
'numbers-here!App'. The Kiss.WindowsPhone.exe process started, but the
activation request failed with error 'Msg in polish that the app did
not start'.
If this was Windows I would check System Event Log and see the logs just before the error what DLL the system was trying to load and that helped a lot when I was debugging similar problem with Windows Store project, here I have no clue on how to check what exactly was being loaded.
The worst part is that I created package (appx) and checked the dll's being packed with exe, it seems that it includes dependencies that the app explicility uses yet something is still missing and this might be some 'hidden' dependency of one of the other dlls.
Any ideas how to debug such issues with emulator?
For me it was due to having WIC code in my App and/or calling CoCreateInstance in a windows phone environment ( on PC it works flawlessly though )
I ran into the same problem on Windows 10. Turns out, that there is no Kernel32.dll on Windows 10 phone!
Instead you need to link against OneCore.lib which provides the entire Win32 API subset that is supported in UWP. This "umbrella library" will load the correct dlls at runtime.
See also:
https://msdn.microsoft.com/en-us/library/windows/desktop/mt683763(v=vs.85).aspx

running a vc++ command line application on non development machine,

When I run command line application (executable generated using visual studio 2008) on non development windows 7 machine it gives following run time error "application has requested run time to terminate in unusual way. Please contact application support team for more information". It runs fine on a development machine.
With VS 2005 and VS 2008, Visual C++ used a side-by-side versioning scheme that requires manifest entries embeddded in the EXE to really work correctly in all cases. It's possible you are dealing with one of these. See these articles for details on debugging these side-by-side issues.
Diagnosing SideBySide failures
Part 1: Troubleshooting VC++ Side by Side Problems
Part 2: Troubleshooting VC++ Side by Side Problems
Note that with VS 2010 and later, Visual C++ no longer uses this side-by-side scheme. That said, there are still lots of reasons to use embedded manifests anyhow. See this article.

Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable

I'm writing a console app for SharePoint 2013 on a 64-bit machine. I get this error when I try to execute the program:
"Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable."
Please let me know if you've had this problem in the past and can help. Thank you!
Have you checked the the properties for your project? (solution explorer, right click on the project, click on properties)
On the build tab check for that you select "Any CPU".
This worked for me:
In Visual Studio: TOOLS>OPTIONS>Projects and Solutions>WEB PROJECT and Use the 64 bit versions of IIS Express for web sites and projects
I hit this problem while running a Unit Test (well, an integration test in "Unit Test" clothing). Changing the target for the unit test project just made the tests disappear from the Test Explorer. It is possible to run your tests (at least in VS2013+) as an x64 environment.
In Visual Studio, choose Test > Test Settings > Default Processor Architecture > x64.
https://msdn.microsoft.com/en-us/library/ee782531(v=vs.120).aspx
Sometimes, if "Prefer 32-bit" is greyed out, and your Platform Target is already "Any CPU", the problem is that IIS Express is not 32 bit.
The solution is to change the solution's web server to Local IIS.
This blog details the steps in more detail:
Platform Not supported Exception when running Visual Studio Web Application
What worked for me was changing a registry key:
HCU\Software\Microsoft\VisualStudio\12.0\WebProjects\Use64BitIISExpress
to 1, as shown here:
https://rule30.wordpress.com/2015/06/22/microsoft-sharepoint-is-not-supported-in-32-bit-process-please-verify-that-you-are-running-in-a-64-bit-executable/
I got the same issue. The Build tab has the option Any CPU, but still it was not working.
I have selected explicitly x64 as the Platform target, and the application works fine :)
for me it was because of invalid reference to Microsoft.Shareppoint.dllafter migrating to SharePoint 2013 in a console application we used for some automation
just add below address of Microsoft.Shareppoint.dll
Correct
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.dll
you can found this reference to this correct dll , after creating a empty SharePoint 2013 project in your UAT.
I was getting this error inside my Windows 2012 R2 UAT and Visual Studio 2015 Update 1 , when my reference was incorrectly to a dll found in GAC
Incorrect
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint\v4.0_15.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.dll

Problem in hosting ActiveX on Vista (in a Visual Studio 6 C++ application) II

(I'm re-posting this message since I signed up as a user now)
I just installed Visual Studio 6 (SP5) on a Vista Enterprise machine. Had some problems but I think it’s set up alright.
The problem is my VC++ 6 application fails when trying to host an ActiveX. I was able to compile it ok, though got a warning message from Vista about the rc.exe (“This program has known compatibility issues” ).
When I debugged it I saw that my class that derives from CAxDialogImpl fails on its Create() method. The same application worked just fine on XP!
Is there a known compatibility issue there?
Some tech info: I saw that CAxDialogImpl::Create() (I pass NULL here) calls AtlAxCreateDialogA, which in turn calls CreateDialogIndirectParamA which throws a general exception.
Thanks a lot, Erik
PS -
1. I am Admin on my machine. OS is 32 bit.
2. I know that VS6 is not supported on Vista but I had no choice since I ran into troubles trying to migrate it to VS 2008.
OK.
Found the reason and the solution.
It appears to be a DEP compatibility issue.
It was hard to locate since when the application failed no exception / message shown.
The problem was caused due to old ATL components used in the my dll.
Old versions of ATL generate machine code at runtime and then attempt to execute this code from pages of memory that were not marked as executable, thus causing a DEP violation if hardware-enforced DEP is enabled.
The difference between my XP machine and the vista machine was actually in the DEP operation - the DEP on the vista is hardware-based, which caused the problem.
Also, I had COM applications using the same dll and working fine, however .Net applications were failing because they were created with the DEP compatibility flag.
The solution was to remove the DEP compatibility flag from the .Net applications.
Cheers,
Erik
PS - two links were very helpful:
http://support.microsoft.com/kb/948468
How to make my program DEP-compatible?

Resources