c# application working on development machine, fails on non-development machine - c#

this problem has me baffled.
I'm writing an application which is supposed to take information from a form, pass it to a background worker which then a) writes the information to a local xml file and b) inserts the information into a remote MySQL database.
On my development machine, it seems to work flawlessly. The remote database is updated, the xml file is created if necessary and updated if it already exists. It's working.
Even if I exit out of the development environment and run the release build independantly of the IDE sandbox, the code works.
But, if I put it on another machine, the code fails and I dont understand why.
I'm currently using Visual Studio 2010 Professional on a 32 bit Windows 7 Ultimate machine.
At the moment, I'm finding that the application is stopping at a fairly specific point, which seems to be precisely where the background worker starts doing things like accessing the file system or accessing the remote database.
The project consists of a single exe file and a dll, which has a custom control I designed in it. The custom control is working fine, in that it shows what I want it to and returns the values I'm asking it to when I want it to, so it would seem that isn't to blame.
I initially thought I could be looking at a permissions problem, but running the application as administrator gets me the same response.
I've been writing using version 4 of the .NET framework, however I've just downgraded that to version 3.5 in the hopes that that may help. Both the non-development machines I've tried have been up to date - or have been brought up to date by me - prior to attempting to run the application.
I'm honestly baffled here. Any suggestions would be most welcome.
Alan

If your code fails, it most likely means there is some uncaught exception. What you should do is to log all uncaught exceptions (and probably some of the caught too) to a file, possibly using something like log4net.
I don't think we can help you beyond that.

I have written a live logging utility called Donsole for diagnosing the application in such conditions. On the developer workstation, it is very easy to diagnose using the feature-rich debugger of VS. The utility app. helps the developers exactly in this kind of scenarios where they don't have any idea what's happening inside. I recommend you download the latest build and try it for yourself. Explaining how to use this utility and how it works is beyond the scope of this answer, so I'd forward you to the codeplex page of the project.
http://donsole.codeplex.com/
This is how it looks.

Take a look at the event viewer of your operating system. Administrative Tools>Event Viewer>Windows Log>Application.

Related

Visual Studio 2017 C#: How to create an Installer that can provide continuous updates

I've been trying to find an answer to this for weeks. Hopefully you are able to help me out! :)
I've got a C# application. It has multiple classes and multiple Forms. The forms also have images on them in PictureBoxes.
These images are all stored in an Assets folder inside the bin folder i.e. /bin/Assets.
When developing, I run the application in Debug mode.
I have looked on YouTube and all areas of the internet to find how to create an installer for my application. I see a majority of posts about ClickOnce deployment, which looks like it's what I want. The issue is that the ClickOnce wizard asks you where to install the application:
I do not have a server to host the application on (I have tried examples I've seen such as \localhost\myfolder\myApplication) I do, however, run my own website through a NameCheap host where I could provide a link to the application for users to download. I'm not quite sure how to set this up though.
I do not want the users to install from a CD
I don't know how to do the File Share method
This is the first obstacle. Regardless of what I choose, I cannot get the setup to work. I think the big issue is that I can't find how to include my Assets in the project and I don't know where to install the application.
The next obstacle, is that when users download my application, I would like to be able to push out an update, and have them have the update automatically (or only need to restart the application to get the update). I do not want them to have to re-download the application every time there is an update, as there are updates several times per week.
Again, I believe ClickOnce handles this but since I cannot even get to this step, I am not sure.
So, in the end, this is the use-case:
User is able to download the application from a website. Once application is downloaded, all further updates to the application are pushed automatically or only require a restart of the application to obtain.
I have gone through all the documentation on ClickOnce as well. Specifically this link. My issue is on #4.
I hope you are able to help, thank you!
Sharing the installer should not be an issue you could simply do that through Dropbox.
You can host your Updater on Dropbox as well but anytime you have new Updater replace the old one so the web link remains same and that it is because you need to know the the Updater link in advance to put it in the original installer.
You mentioned that you have a website through NameCheap, I believe you could use that instead of Dropbox here is a youtube links that might help.
https://www.youtube.com/watch?v=PEXcWln2Fe8
https://www.youtube.com/watch?v=rUNQphoGVwQ
I personally don't use ClickOnce but I use A Microsoft Windows Installer and I develop my own updater. ClickOnce is easier use for you at this point but later in future, you could explore other ways.
Wish my answer is clear if not just let me know,
Good luck

c# Wpf application different behavior

I hope someone can help me, as I can not find the solution myself. (I know Google is my friend..etc)
So, I have a relatively simple c# application (it reads a specific XML node from three different XML files and then adds these nodes innerText to a combobox. - for find and replace)
The application runs fine on my own work and home computer both in VS debug mode and as .exe.
But when I sent the .exe file to my colleagues (from 3 people, 2 failed) they have experienced that the program started but the combobox was empty.
(all computers are running Win 10, no restrictions on the office computers, all windows updates are installed)
So I'm out of ideas...
Apart from the excellent suggestion of adding logging (loads of it, at every relevant line of code for debugging purposes), if you're using WPF, you can also use Snoop, which will allow you to dig into the binding, which can be very helpful.

How do I determine why our application crashes for some people, but not others?

This is a tough problem, which I'm not sure how to solve. (Hence my asking here, :) ) I'm on a team of about a half dozen developers working on a WPF app. At this stage we've got a working application. Not all of the features are in it yet, but we're making progress. Everyone on the team can run the app, except for our boss who has a problem running it. When the app first starts it brings up a start screen/landing page with some buttons. All of the rest of us when we run the app we can easily click on any of the buttons. One of these buttons is labels "Orders" and takes the user to another screen where they can work on the orders. When our boss runs it, the app always crashes. However it doesn't do this at all for me, nor any of the other developers. This makes it really hard to figure out what's wrong because I can't duplicate it. I've got to admit that the problem might not be with WPF, but might instead be with the .NET framework, but at this point I don't know. I've got to start somewhere.
So ultimately the question is this, how do I determine what's failing on a different machine than my own? One that I don't have access to?
We're working with VS 2015, .NET Framework 4.5.2.
Diagnostics and logging.
Add as much diagnostic code as you can think of (and then add some more) to the code and log it to a file or the event log or a remote database or where ever. This would include call stacks, parameter values, system information etc. Then when the application crashes you can examine these logs and determine what's different between your machine and the customer's.
Without this information you're just guessing.
Quick check before you do anything else: right after a crash run Event Viewer and go to Windows Logs -> Application. You should see a number of messages related to the app and the crash including exception information that often sheds light on exactly what's going wrong.
You can put some crash report controls,
Find similar question hear exception-reporting-from-a-wpf-application
or try something from hear : CrashReporterdotNet
,
Crash nuget
This is a long shot, but easy enough to research. Your problem may have its root cause in hardware. Compare the video cards of your peers and boss. Your boss may have a card that's not within the Microsoft recommended guidelines. In WPF, there are ways to manage rendering based on the hardware.

Winform application doesn't run properly

In my home and work pc's and in one friend of mine's it runs just ok, but when i sent it to someone else it 'loads' for 10 seconds responseless, then there is an error:
alt text http://dl.dropbox.com/u/3045472/Sem%20t%C3%ADtulo-1.png
Since it works on at least four computers, i assume the program itself is just ok (same exact EXE).
What could be happening ?
info:
C#
.net 3.5
worked on Windows 7 32/64 bits,
windows XP and vista.
does some threading simple stuff, but
it doesn't even open the form, and it
doesn't open up running either, so
the functionality is irrelevant.
There are infinitely many possible answers. So I will give you the way to figure it out instead.
Add a handler for the event: AppDomain.CurrentDomain.UnhandledException of type UnhandledExceptionEventHandler.
You will be able to see the reason for the crash. It's probably best to write it out to a file somewhere anyway.
The first check is to make sure the .NET framework is already installed on the target machine, then make use of Brian's suggestion (which will not even work if the framework is not installed!).

ClickOnce & XNA issues

I essentially have a blank XNA project built using the XNA 3.1 wizard, i'm testing whether a game i make can be "installed" on another computer without having to make them install everything manually to make it work.
The only additional code in the game is:
Components.Add(new GamerServicesComponent(this));
After going through the ClickOnce publishing stage i copied it to a USB drive and attempted to run the "setup.exe" on a Windows Vista computer with no Visual C#/Studio or XNA installed.
According to the MSDN entry the ClickOnce will actually include everything necessary to make the game work on the computer, yet after the installation i get the dreaded "... has stopped working" when i try to run it.
Does anyone know how to get around this? I assumed the reason it says it can be done is because it works.
Thanks
http://msdn.microsoft.com/en-us/library/bb464156.aspx
Edit:
Just noticed that the article states that the Games for Windows - LIVE is not included in the distributable, would this mean if it was included as a component in the XNA game it would cause the crash when i attempt to run it?
When an application says "has stopped working" for no immediately apparent reason, that's usually a sign that an unhandled exception has occured. Since MSDN states that the GamerServicesComponent class is not available without the XNA Game Studio installed, that seems like the most plausible explanation.
Why is it available, then? Well, you need something to program up against; you wouldn't be able to use auto-completion and such if you didn't have the class, because VS wouldn't know what it looked like
Getting it to compile for, say, XBox 360, where I would guess that the class CAN be used, probably wouldn't work either if it didn't know anything about the class.
To address the general problem of a ClickOnce application which "has stopped working" immediately, you can get more information on your particular problem by looking in the Windows Event Viewer:
http://windows.microsoft.com/en-US/windows-vista/Open-Event-Viewer
Like Michael mentioned, this is often an unhandled exception, but this way you can see WHAT the unhandled exception was.

Categories