Solved

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

Posted on 2016-10-06
6
34 Views
Last Modified: 2016-10-06
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
Comment
Question by:bthouin
  • 2
  • 2
  • 2
6 Comments
 
LVL 32

Assisted Solution

by:ste5an
ste5an earned 200 total points
ID: 41831525
Step 1: Add error handling and logging.
Step 2: Check your references. Has the second machine the same .NET framework installed?
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 300 total points
ID: 41831623
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
 
LVL 1

Author Comment

by:bthouin
ID: 41831641
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 32

Expert Comment

by:ste5an
ID: 41831649
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
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 41831654
>>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
 
LVL 1

Author Comment

by:bthouin
ID: 41831677
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now