What causes "Method ~ of object ~ failed" in a VB6 application? - vb6

I am working on an old VB6 app and have recently added the Siemens OPC component. When running in VB6 debugger I have no problems.
I then created a deployment package (Siemens OPC dlls included in the package) and deployed the app on the same PC. I then get the following error message when accessing the OPC object:
'Method ~ of object ~ failed'
Can anyone suggest what might be causing this or what I can do to get more information?
UPDATE
I am aware of other questions around this error message. What is puzzling me here is that there are no problems when using the VB debugger. The problems occur after deployment - even on the same machine. I would have thought that all the components remain registered and available.
CODE
Public Sub InitialiseOPC(ServerIP As String, OpcServerName As String, BaseAddress As String)
On Error GoTo ProcError
IsInitialised = False
Set MyOpcServer = New OPCServer
Dim LocalServers
LocalServers = MyOpcServer.GetOPCServers(ServerIP)
....
The error occurs when GetOPCServers is called. This is the first time the OPC component is accessed.
Is there any way to trace what VB is doing at this time (e.g. dll loading) ?
UPDATE
I tried deploying the Siemens dlls to the application folder instead of the default locations and this error message no longer appears.

Method ~ of object ~ failed is generated when an exception (SEH) is thrown during a late-bound call. VB6 makes the effort to "wrap" each late-bound call to catch such unexpected behavior.
In your case most probably a VC component is trying to load a dependent DLL or COM object and fails but does not handle the failure gracefully. Instead it tries to call a method on the empty reference and bombs with an Access Violation or similar exception.

Related

S4 SDK call takes long time and stopped without error

I encountered a strange issue. The execute call to get S/4 Business role authorization details, made by using S/4 SDK takes long time, then stopped without throwing an exception. the code used is shown below. The url is https://my300470-api.s4hana.ondemand.com/sap/opu/odata/SAP/APS_IAM_SIAG_BROLE_SRV/getAuthDetails?ID=%27SAP_BR_INVOICING_SPEC_CINV%27&$format=json&sap-client=100&saml2=disabled
The call works for some roles, but for some other roles, it takes long time, then stopped without throwing exception.
List<IagprivilegeauthDetails> authDataList = new
DefaultS4cBusinessRoleMetadataService()
.getAuthDetails(bRoleId).execute(configContext);
After some investigation and other reports of issues like this we found the problem:
A library that we use did not close all HTTP resources properly.
After upgrading the library this should be fixed with version 2.19.0.

"~" symbol created automatically after running project with service worker

My project is a simple login page. I am using asp.net core with MVC.
Everything was working well and I wanted to add service worker to my project. I followed the known steps. Add a manifest.json file in wwwroot, fill it correctly and add this function services.AddProgressiveWebApp(); after services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);.
When others do these steps, service worker works properly. When I run it (IIS Express), service worker produces an error: "Uncaught (in promise) TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script."
Then I realized this thing: https://localhost:44331/~/serviceworker.
The ~ symbol is created automatically and I am not knowing how to remove it.
The following https://localhost:44331/serviceworker works.
Help?
It is solved.
I updated the version from v1.0.42 to v.1.0.33 and it worked.
v1.0.42 has a bug.

Sometimes System.Runtime.InteropServices.COMException (0x80080005)

I am calling a Function of a Service from a homepage.
The strange thing is, this works for hours, then I do not change anything and suddenly I get the following exception:
System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {00020906-0000-0000-C000-000000000046} failed due to the following error: 80080005.
Then it doesn't work anymore.
When I restart the server, it works again. I am pretty sure that this is a setting in the dcom config of the Service, but I already tried everything.

Web API 404 File or Directory not Found for "root" routes

I am developing a RESTful web api service. It's web api v.1, not v.2. Also I am developing on Visual Studio 2010 SP1. I have installed the MVC 4 for VS2010 SP1.
Please understand and keep in mind that Upgrading to newer versions of VS or Web Api 2 is not an option.
I have the following problem after a Windows Update ocurred.
When I try to use my RESTful api this way....
http://url.com/documents/ (get all the documents) I get the following error...
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Here is the stack trace.
[HttpException]: File does not exist. at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response) at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath) at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) at system.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
If I specify the action name directly, it works. For example...
http://url.com/documents/get (gets all the documents) or
http://url.com/documents/7 (gets document id=7.
It only fails when you call it by its default name. I have already read similar situations here and I have tried to follow their solutions but they are not working for me properly.
Now, I know this is not a "web api routing" issue because I actually get the .net default exception page html markup (I am using Postman to test my webservice). When I force a "routing issue", then I get a JSON error description, which means that the Controller actually got created in the pipeline and returned a response.
Also, I have a custom file (SecurityHandler) that inherits from DelegatingHandler. This file gets executed almost first in the pipeline with each call to the api. Even before the actual Controller. Well, this file is never called when I get the error, which confirms to me that the "webserver" (either VS Development Server or IIS 7) is the one throwing the exception.
I have exhausted every single solution that I have found here. Change my web.config to multiple handlers configurations, re-installed MVC 4 for VS2010, created an entire new project... all these efforts have shown no results whatsoever.
Like I said, this was working perfectly fine until my pc restarted from a Windows Update BUT... why does it fail in the server as well? I did deploy my api to the server after the error started to occur.
Thanks.
The issue is not in Web API (and has nothing to do with it's version or Visual Studio 2010), it's the static file handler trying to serve and failing.
Alternatives:
0. Do you have a documents folder in your site? Get rid of it.
1. Remove the static file handler for directory browsing and re-add it.
2. Use RAMMFAR (less recommended)

My Working Application MVC3 Razor Unexplainably stopped working :-( IIS 7

I have the following projects within my solution.
MyWebApplication.Data --> Here i interact with my Data Repository
MyWebApplication.Services --> Here i interact with the Data Layer
MyWebApplication.Web --> The UI which relies on the Service Layer
MyWebApplication.Tests --> Unit testing project
For MONTHS i have had NO problems with IIS in my local dev environment. Ready for a long weekend of programming but all day i have been getting 500 Server Errors when simply trying to resolve the Home page. Before I went to bed all was well, the entire day thereafter i could NOT even load the home/index view.
After looking at the logs it says continually MyWebApplication.Data.System (which is a class i created called System()) does not include Web. But no where in code is this true. Then i get another error of mismatching files in the Temp Directory.
Steps I have taken:
Deleted all temp files
Created a new repository in IIS and pointed URL there, No luck
Cleaned solution
Deleted all bin folders to have regenerated... No Luck
PLEASE HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Without the details of the error messages, one strategy may be to create a new MVC project and copy/paste the files over to it.
A few other common causes:
Are you referencing any 64-bit libraries but compiling the project as 32-bit (or vice-versa)? Try changing the "bitness" of your application.
If your application is 32-bit and is running on a 64-bit server, you need to enable running 32-bit apps in IIS. See http://exhibita.com/blog/post/2010/03/30/IIS-75-on-x64-with-32bit-applications.aspx
If all else fails, please post the exact error messages. If all it says is "HTTP 500: Internal Server Error", you should enable debug output or run your app from the server itself (actually using a web browser on the server), which will tell IIS it's "safe" to display full debug information. The debugging messages have actually been pretty useful in my experience.
Figured it out. In
MyWebApplication.Web project, within the Shared/Site.Master I added a imported a reference to my Data Layer. (i.e., <%# Import Namespace="MyWebApplication.Data" %>
I resolved by removing the static reference to my ShoppingCart class in the Data layer and just created an ActionResult to return the same and in the MasterPage (which currently holds the javsscript to allow the user to peek into their cart from anywhere in the site without a redirect to a specific page) used the Html.RenderAction() and just returned Content(shoppingCartString).
Guess I have learned that within the Site.Master page it is complied differently than every other page in an MVC application. I can positively say this because in other pages I am doing exactly as I attempted to do here without any issues. Maybe its the build process?
Anyhow, problem solved and hopefully it can help someone else too.

Resources