Web Reference Access Violation in Delphi 2005 .NET - web-services

I am creating an application that consumes a web-service in Delphi-2005 .NET.
How I am doing it is adding a web-reference to the project and then supplying the url to the wsdl. This seems to work fine in that a pas file is generated and added to the project but as soon as I compile the project I get and access violation in the Ide in dcc90il.dll
Anyone know how to solve this?

I suspect a fundamental .net interop, IDE, or RTL bug in Delphi2005.net. Can you download the trial version of Delphi2007.net and try it there?

I have been unable to get this to work or even determine why it is failing. I ended up generating code from the wsdl using wsdl.exe from MS and then compiled the source to an assembly using csc.exe.
The assembly works fine but Delphi generates obscure errors if an error is returned from the server.
imo Delphi sucks.

Related

Bad image format when running managed C++/CLI assembly in .NET Core 3.1

I was super excited to see that the latest previews of .NET Core 3.1 and Visual Studio 2019 add support for managed C++/CLI projects, as such a project is the only think keeping a particular project on .NET Framework.
So, I installed Visual Studio Preview 16.4.0 Preview 4, along with the "C++/CLI support for v142..." options, and as expected I see the new C++ CLR templates and have .NET Core 3.1 preview 2 installed
I created a new project using the "CLR Class Library (.NET Core)" template, copied the files an old managed C++/CLI project, tweaked a little, and the assembly built - great!
However, when I try to use the assembly in a .NET Core 3.1, I get this fatal exception:
Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'MyAssembly, Version=2019.0.1.0, Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format.
File name: 'MyAssembly, Version=2019.0.1.0, Culture=neutral, PublicKeyToken=null'
at TestApp.Program.Main(String[] args)
Both the managed assembly and test app target X64. Any ideas what could be the problem?
Someone from Microsoft provided the solution over on the Github repo.
When the managed C++/CLI project is built, a file ijwhost.dll is placed in the output folder alongside the assembly - this file needs to be deployed with the app that uses the assembly.
After putting ijwhost.dll in the same folder as the app, it worked as expected.
As an aside, the old C++/CLI project that I built against .NET Core 3.1 preview is actually quite complex - I'm very pleasantly surprised that it basically "just worked"!
Hopefully a better error message will be used in future!
I am using .net 5.0 as the CLI runtime. I finally found that the problem I have is missing native dependency DLLs.
For native applications, there will be an error prompt telling you which DLL is missing. While in .net core C++/CLI, they only give you a BadImageFormatException.
My solution is, create a pure native console project, paste the code that will cause BadImageFormatException, run it and see which DLL is missing then add it back to C++/CLI project file list.
I just found some unexpected dependencies.
In my case c# Net 5.0 app loads managed C++ dll, which is wrapping around unmanaged C++ dll.I get this error every time i try to run on on machine with no Visual Studio installed. I debugged it with ProcessMonitor and figure out that it can't found VCRUNTIME140D.dll. Found these dlls in my dev PC, copied them (both 32 and 64 bit versions) from my dev machine to customer's one to corresponded folders, and it made the trick. Hope will help somebody. Cheers.

VS2017 Error: The operation could not be completed

I'm attempting to merge some code from a 3rd party. I thought I merged the source file ok as well as the .vcxproj files. To test out, I tried to do a compile of a single source file. It did a compile and failed with a message (don't remember what atm) and I addressed the error and tried to build that source file again. What I got was
1>Error: The operation could not be completed
Yes, not very helpful error message and I'm at a loss. I tried to delete the object files and tried again, I still get the same message. It doesn't seem even building anything. What can I do to get VS2017 to give me more helpful diagnostics? What could be causing this issue?
I got this error when moving a website from .net 2 to .net 4.6.1 which was hosted on local IIS7.5. It also showed as Visual Studio throwing all manner of errors upon loading the solution (pointing me at the not very helpful activity log)
All of my assemblies had been recompiled to .Net 4.6.1 and I'd changed the app pool to run .net 4 and integrated, however, VS seemed to think the web site should be loaded or compiled as plain .Net 4.0. This meant that it couldn't load the .Net 4.6.1 assemblies but didn't register this error just said it couldn't complete the operation.
I amended the web.config to add targetFramework="4.6.1" into the compilation element and it fixed it.
I just had this same error which drove me mad for hours. It turned out to be due to some sort of mix-up in the compilation configurations in the solution file, which made reference to configurations that did not exist (because the solution had been copied from another with more projects in it). What appeared to fix it was just going into the configuration manager dialog and then saving.

C++ REST SDK Sample on Galileo

I would like to run the sample of C++ REST SDK posted in the Windows Developer Program site: https://ms-iot.github.io/content/Casablanca.htm
I was very careful to follow the steps, also using the version 2.2 of cpprest lib instead the latest one (2.4), the result is that I could run successfully the project and deploy it on my Galileo, but when the client object try to resolve the request using the sample posted in the page I received the following error:
Error exception:Error in: WinHttpSendRequest.
The code is the main.cpp in the link above, and I'm trying to run it in my Intel Galileo.
Appreciate any help because it's a bit frustrating can't find info about this error.
The most common cause of errors in the WinHttpSendRequest API are networking/DNS/firewall issues.
One easy thing to check is to ping www.bing.com from the Galileo (Telnet) command line. If that fails, then that's almost certainly the cause. You can replace www.bing.com with the IP address as a quick-and-dirty workaround.
If that's not it, is there a possibility that a firewall is blocking your request (e.g. if you are behind a corporate firewall)?
Did you run the code in the Visual Studio debugger? Can you narrow down where the exception occurs?
If that doesn't help and you're stuck, you might want to try the non-Casablanca approach: http://msdn.microsoft.com/en-us/library/windows/desktop/ms737889(v=vs.85).aspx. Personally, I find Casablanca's asynchronous structure to be confusing, and it's not of much benefit in my projects (basic HTTP client requests). Support for Winsock is packaged with the Windows image running on the Galileo, so no messy prereq configuration required.
Dan.

visual studio 2010: error code -2146232576 (0x80131700)

I have to convert a C++ project from visual studio 2008 running on Windows XP to 2010 running on Seven. Compilation seems to run perfectly but during the debugging I have an error: "The program 'App.exe : Native' has exited with code -2146232576 (0x80131700)."
After a few researches on the internet I found out that the issue is in relation with .NET.
I tried to update my windows with hidden updates, check what the .NET version target is 4 and a few more things that doesn't work...
Has anyone ever encountered this issue ?
Thanks a lot.
EDIT: it is a managed C++ project
It is a low-level .NET initialization error, the CLR cannot get loaded. That's pretty hard to explain since you can run VS2010 without a problem and it already uses .NET version 4. The only decent guess is that you are actually using a C++ project (not a C++/CLI one) and that it loads the CLR itself. And asks for and old version, like 1.1, one that isn't installed on the machine. Search the code for "CorBindToRuntime".
Have you installed all Windows updates lately? If not, do so - seems to be some general .NET related error - see:
http://social.msdn.microsoft.com/Forums/ta/wlgeneraldev/thread/8f9d610f-92b2-4262-8e1a-88cee8428aed
You are running native code I presume? Are you?
If that is a case this error is caused by something else.
If you are using managed C++ than you have a problem related to the .Net framework.
Remember that some error numbers returned may (and they do) indicate different causes, depending who return an error.
Giving more information about what is your application doing and what language it is written would definitely help isolation problem.

Problem with System.Runtime.Serialization.SerializationException

I am having a few troubles with a set of hosted code on an WS2K8 R2 box with IIS 7. I have another server running WS2008 that does not encounter the same issue. I have copied the application code from the old server so that it is identical.
The exception thrown in my server side logs is:
"ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain."
I also have an error being returned in VS2010 at the same time:
Unable to find assembly 'msvcm80, Version=8.0.50727.4927, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I have checked and the correct version of msvcm80 is on the server in the "C:\Windows\winsxs" folder. I have also installed Microsoft Visual C++ 2005 Redistributable (x64) and (x86).
I cannot see why the error might be thrown??
My debugging expierence is low so please bear with me.
I re-checked the version details. It appears that it was a requirement of the Microsoft Visual C++ 2005 Redistributible. I re-installed all versions of it on the server and applied the security hotfixes.
After a re-boot and testing in IIS the issue has now gone from my log files.
I did check the comparison between the two servers and wasnt that happy copying the files over. I felt it was best to try this method first.
Thanks for your help.
msvcm80 is a .NET Framework mixed assembly (microsoft visual c++ managed + unmanaged). You might try to find this file on the second server and place near your application on the first server machine.
Note: .Net Framework Runtime requires exact version of an assembly (8.0.50727.4927 in your case).