We have a managed C++ Adobe Reader plugin specifically designed for Reader X / XI. It works fine in Windows 7, but on Windows XP it throws a COM error - Class not registered.
What's strange is that this only happened after we updated the project from a vs2005 project to vs2010. The old vs2005 plugin works just fine. Anyone have any clue as to why that would be? We just used the standard project auto-upgrade when we moved to 2010. All the rest of the code is the same.
Edit: some more notes about the issue
The plugin DLL itself loaded just fine. It was only when we tried to load a .Net 4 dll through COM interop that we experienced the exception.
Previously, the dll that we were trying to load was written in .net 2.0, and that loads just fine in Windows XP. But the .Net 4 dll will only load in Win7. Note that .Net 3.5 seems to work just like 2.0. It's only .net 4 that breaks (we recompiled the exact same code to 2.0, 3.5, and 4.0 to check).
Turns out the problem is a combination of Adobe's Protected Mode and trying to load a .Net 4 DLL through COM interop, but only on Windows XP.
Bizarrely... change any of those variables, and everything works fine. .Net 3.5 and 2.0 both load fine with Protected Mode on. Windows 7 loads the .Net 4 dll fine with Protected Mode on.
Turning off Protected Mode in Adobe for Windows XP fixes the problem so the DLL loads fine.
I hope this helps someone else who runs into this.
Related
I have a code base of native C++. Recently I incorporated a Windows 8 tablet into the system that we deploy to.
I have a .NET managed DLL that accesses the Tablet orientation sensor. This managed code is wrapped by an unmanaged class that I can access from the native C++.
The problem is that I cannot run and debug the code on my Windows 7/VS2010 box without getting an Access Violation at the outset. No breakpoints are even hit before the exception.
Is there a way to ignore the managed DLL while debugging on the Windows 7/VS2010 box?
Delay loading is your friend. Read the MSDN documentation, starting with Linker Support for Delay-Loaded DLLs.
I am running 32bit development environment with Win 7 and VS2010.
I was able to register the Delphi created ActiveX in Windows7
regsvr32.exe "C:\Program Files\MyApp\Test\DelphiActiveX.dll"
Then I added reference in my VS2010 Windows Form project.
I tried the c# 4.0 way of using ActiveX with a dynamic object but it is not working. Nothing happens.
// c# 4.0
dynamic myActiveXLink = Activator.CreateInstance(Type.GetTypeFromProgID("DelphiActiveX.DelphiActiveXLink"));
//dynamic myActiveXLink = Activator.CreateInstance(Type.GetTypeFromCLSID(""));
myActiveXLink.SearchByName("FName1", "LName1");
SearchByName method should start a third party application installed on the computer.
EDIT: The CreateInstance() is executed without error.
Now I am getting Exception at the myActiveXLink.SearchByName() call:
Exactly the same code works fine under WindowsXP and VS2010, but fails under Windows7 32bit and VS2010.
I have a C# WPF application built in VS 2010 with Target Platform set to x86. This exe calls on a Managed DLL with target platform ANYCPU. The Managed DLL has a reference to a C++ DLL which is compiled with Common Language Runtime Support (/clr) option.
On .NET 3.5 the app works perfectly with on any OS. It works fine on Win 7 as well, on both 32bit and 64 bit.
Now that I have converted the application and its DLLs to target .NET 4. If it is run on a .NET less than 4, it throws an error that .NET 4 is required which is the expected result.
The converted app works fine on my development system and on any system that has .NET 4 + .NET 3.5. So far so good!
However, on systems with ONLY .NET 4 (ie Win 8) or win 7 without .NET 3.5, I get the error:
Could not load file or assembly 'x' or one of its dependencies. The specified module could not be found.
'x' is the C++ dll compiled with Language Runtime Support (/clr) option.
So, in short the problem only happens on systems with .NET 4 only.
Any advice would be appreciated.
Thank you,
- Kam
.NET 4 has back compatibility with all previous versions. So it doesn't seem the problem is in the platform version. Might it be folder's security? Try to check its permissions.
There was a change in native code loading policies since .NET 4. To resolve this, please add the App.config file to your .exe project with the following contents:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
</startup>
</configuration>
This discussion may also help: What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?
Original app was developed with VS6 MFC for WinXP - then ported to VS 2005 Vista, and runs fine in Vista. However, when installed in Win7 the app runs without crashing but the UI is scrambled. Windows controls all seem to line up on left edge of main window.
Can this app created with VS2005 in Vista run properly in Win7? Or does it need to be compiled and linked in Win7 to run properly in Win7?
The most likely explanation is that your program has bugs in it, or rather it makes assumptions about Windows that aren't valid: a correctly written program built on an old system with an old version of Visual Studio will work fine on Windows 7. As ever, just because something worked on old versions of Windows doesn't prove it's "right".
There aren't any easy shortcuts for this: you're going to have to debug your application to figure out what is wrong with it.
Firefox depends on an extension and plugin installed by the .NET 3.5 installer to run XBAPs. Unfortunately, in Windows 7 the .NET 3.5 runtime is already installed.
Does anyone know how to get a hold of these plugins/extensions so you can actually deploy XBAPs to FireFox on Windows 7?
Turn out, the answer is to copy the DLL of the extension out of another (presumably XP) machine that can run the .NET 3.5 runtime and deploy it.
I'm uncertain of the legality of this maneuver, but it works.