System.InvalidOperationException - No error details - vb.net

A VB.NET app is working on XP, but not in Win 7. User executes the program and it immediate dies with "Stopped Working". A Report.wer file was created and there's no detailed reason other than "System.InvalidOperationException".
How do I get it to tell me more. I put a messagebox in the form load, but it didn't get that far.

I've seen this exception thrown when attempting to run a Windows Forms applications when some of the controls used by the application are defined in a separate assembly which is not present on the machine you're trying to run it on.

Related

Get focus of other application from Vb.net Service

I have got a vb.net windows service that runs a File System Watcher to monitor an xml file for changes, when it detects a change it will stop the screen saver running and what I would then like it to do is give one of the other running applications the focus.
I have successfully used Appactivate from a Windows Form App in the past but I think I am correct in saying this doesn't work with Windowless applications (I have tried it and it doesn't).
I have done some Googling but I can't seem to find any way of getting the focus when called from a service \ windowless app. Is this possible?
Thanks
what if you make it a single instance application? and then simply launch its .exe file? it might give focus to the other running application instead of opening a new instance.

Visual Studio .vshost causing exception

I'm making a chat program in Visual Basic. It's supposed to be for LAN, and it's called LANChat.
It starts a listener on port 65535 (just for now) and continues to listen on that port. However, if you tried to open two instances of it at once, there'd be a runtime error. I've handled that, and it shows a MessageBox and closes the program if it detects that the port is currently being used. However, in Visual Studio, when attempting to test the program, it runs the program as if it's already being run. I looked in task manager and I see "LANChat.vshost" is running at the time. Any ideas? The only idea I have is to comment out the exception handling code while testing.
Under your project properties > Debug you can deselect the 'Enable the Visual Studio hosting process'. This will take the hosting process out of the question, if it works then then hosting process was interfering somehow, if not then the problem lies elsewhere.
It would be better to create your progra as a single Instance program. Than you should avoid the vshost probme.
I've done it for myself and it works fine.
Sorry i cannot provide code, I am at home :(

How do I start a console application in one project from a web form in another project?

I have a website created in VS 2010 with .NET 4.0. There are multiple projects in the solution. In one of the projects I have a form that gives a user the option to run a console application that is in another project of the solution. (called update.exe)
I have tried just using
process.start(filepath + "update.exe")
but it doesn't seem to run.
It finds the file but then finishes immediately. I tried adding Console.readKey() to the console application so it would stay open after being called, but it was to no avail.
On top of this, I know that the console app isn't running as I have logs set up throughout the console's code and it never even seems to kick off.
Should I be calling the console app differently? (note: I am writing in VB.net)
Thanks!
Purely speculative here.. but my guess is that when the page finishes processing the process is terminated. Try having the page wait for the process to close.
My 'work-around' for a similar requirement is this:
Use the ASP page to create a CMD or BAT file on the server.
Create/write a service that 'watches' for the CMD/BAT file - and when it finds one, it runs it. The service can be written to start a process as a user.

Debugging activeX dll via classic ASP

I finally got my localhost to display the site locally. Everything seems to be working on that end. My next step is to actually be able to step into the code from the VB6 IDE when the web site uses a function from the ActiveX.dll
UPDATE:
I updated the code and removed the issue I was having compiling the code.
Now when I try to debug the site won't open. It just hangs. I'm wondering are there any tutorials that I can read so figure out how to properly get this application setup for debugging?
UPDATE #2
Just to clarify, I got the web site (which references the ActiveX .dlls) locally on IIS 7.5. My hope is that when I open the site (on localhost) I can step through the .dll code at the same time.
That is really what I'm asking.
It's actually quite easy. First of all, do an iisreset. Then load up Visual Basic with your ActiveX DLL. Place your breakpoint, then Run your project.
Then hit your page containing a call to the ActiveX DLL and it should stop on a breakpoint you just set.

Problems with debugging in Silverlight 4 using Out of Browser and WCF RIA Services

With Visual stuido 2010, it's simple to set up SL4 to debug with an out-of-browser installed app. I followed the instructions from here and everything seems to set up fine. Debugging from the browser runs the program just fine, but running from the OOB program gives a different result. After starting, the screen will go blank and then hang forever. I have some concerns that it might be because of some of the technologies that we're using.
Firstly, there's a popup that happens because we're using WCF RIA Services (formerly .NET RIA Services).
"RIA Services will fail unless the silverlight project is hosted and launched from the same web project that contains the RIA Services."
This seems to just be a warning, but I have a suspicion that this warning might be telling me that RIA Services needs to have the .web project as its startup project.
We're also using prism and the error has an odor of a Prism error too. (something loading and then not ever appearing)
Has anyone else had any issues with OOB debugging in SL4? Is anyone else OOB debugging in SL4?
Sorry it's so vague. It's a complicated mess. The only message I see is the italicized popup warning. Then the window (which was previously showing the background of our application) just goes blank
There is currently a known issue with debugging an Out of Browser Silverlight 4 application when using F5 to launch the application from within VS 2010. The question I have is whether or not the application launches without debugging (-F5 or running it from the shortcut)? In the case of using F5, a dialog typically appears with the following error dialog “Unable to start debugging. A fatal error occured. For more details, please see the Microsoft Help and Support web site. HRESULT=0x80070018” and then the application appears to hang. In this case detaching allows the process to continue and then reattaching should allow you to debug the process.
If this is completely blocking or you’re trying to debug code running at startup (like the page startup event), one possible way to get around this would be to put in a call to System.Diagnostics.Debugger.Break, start the program and then attach when dialog pops.
This can be caused by the OOBA install being older than the version you are trying to debug. Remember, Silverlight OOBAs do not automatically update themselves to the latest version of the XAP file that may be available on the server. You have to update them yourself. If you get this error and you have included the auto-update logic in your app, just bounce out of VS, run the app so it auto-updates, then go back in and debug.
Alternately, you can uninstall the app and re-install it. That will ensure you are debugging against the latest VS build.
I ran into this same issue with VS 2008 and Silverlight 3. If I got it, I just jumped out and updated the app then re-ran it in VS and had full debugging.