Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 91
  • Last Modified:

VB.Net application which runs on one machine crashes on another although OS is excalty the same

Hi

I have developed a VB.Net application on a vitual machine running under Windows Server 2008 R2 Standard with SP1, and on that machine, that app runs without any single problem.

Now for the first time I compiled it and copied the corresponding files to a test server which is running under exactly the same OS version, and my app crashes right away badly and I can't even find out why, because the only option offered to me is to "close the program". And although the console windows appears, it's full of weird statements about where the app was, but I can't even look at the contents becaus when I click on that window then Windows gives me the choice between closing the app or searching for the error, which returns nothing, so I'm pretty stuck with the whole thing.

The compatibility check tells me that the app is incompatible (!) although I have 2 other very similar VB.Net apps running perfectly well on that server machine. The only difference is that these 2 apps are Windows forms apps, whereas the new one is a console app, but otherwise their functionality is very similar (the new app should replace the 2 old apps)..

1) any idea what it could be ?

2) any possibility for me to debug the app on the server ? I have no idea how that should be done (if it can be done at all..)

Thanks for your help
Bernard
0
bthouin
Asked:
bthouin
  • 2
  • 2
  • 2
2 Solutions
 
ste5anSenior DeveloperCommented:
Step 1: Add error handling and logging.
Step 2: Check your references. Has the second machine the same .NET framework installed?
0
 
Éric MoreauSenior .Net ConsultantCommented:
it looks like you are missing files. Have you deployed all the files you have found in the same folder as your .exe?

To add tracing to your application, check http://emoreau.com/Entries/Articles/2003/11/Code-diagnostic-an-article-on-tracing-and-debugging.aspx
0
 
bthouinAuthor Commented:
Step 1: done since the start of devlopment, but I get no logging (I'm logging in a SQL Server DB)

Step2: The second machine must have the same or a compatible .Net framwork installed, as my 2 other apps have been compiled on the same development machine as this new app. On dev machine: .Net framework 4.5.1, on server 4.5.2, which does not seem to bother the old apps

Actually, there are 2 hints:
- the error is "System.InvalidOperationException"
- the error seems to happen when the new app wants to log an error, probably the error that causes all the ensuing problems and crash, because the Evnt viewer shows the following:
.NET Runtime error:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException
Stack:
   at BBgDataRetrievalNewApp.AppLogging.HandleErrors(System.String)
   at BBgDataRetrievalNewApp.ClassMain.Main()

AppLogging is the VB routine which logs a string text into a table in the AS/400 DB2 database, but it has full error handling with Try/Catch and showing any error on the console as well as logging the error.
There IS a difference between the new app and the old ones: the old ones log their activities and errors in a central log table in the SQL Server DB, whereas the new one uses a log table in an AS/400 DB2 table. But that table poses no problem when the app is running on the first machine, so I'm puzzled. And also, one of the old app happily writes into tables on the AS/400 DB2 tableswhile running on the server...

So how can I find out exactly what is happening ?
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
ste5anSenior DeveloperCommented:
By logging I'm mean a working logging mechanism. Any logging which logs to a database must be able to log to a local file or the event log in the case that the database is not available for whatever reasons.

But as you said, you're using AS/400: Have you installed the same driver and components on the second machine? Does your AS/400 control access by IP?
0
 
Éric MoreauSenior .Net ConsultantCommented:
>>Step 1: done since the start of devlopment, but I get no logging (I'm logging in a SQL Server DB)

But if your application cannot start correctly or cannot connect to your SQL database, you get no debugging info. This is why you need more basic stuff like the one proposed in my article.

>>whereas the new one uses a log table in an AS/400 DB2

Do you need to deploy any DB2 related DLLs?

>>So how can I find out exactly what is happening ?

You need to add tracing (other than your database) in order to see exactly where your application trigger the error.
0
 
bthouinAuthor Commented:
Sorry guys, I found out what it was: as Eric wrote, I had not copied all the files to the server, and the config file was missing !

That file contained precious info about a web service I'm using in the app, so it conked out because of that: I found out by setting the console window to a much bigger size, and then I saw exactly what the problem was. So it was not a problem of the "environment" (OS, drivers, etc.) but just a problem of copying all the files in the deployment directory of the dev machine...

Sorry to have wasted your time :(
Bernard
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now