?
Solved

.net application crashes when starting using Process.Start()

Posted on 2011-09-13
6
Medium Priority
?
274 Views
Last Modified: 2012-05-12
Hello,

I'm trying to launch a Winforms .NET Application (App1) that I created from another Winforms application (App2)  using Process.Start().  But sometime the application (App1) crashes on startup.   This never happens when I directly run App1.


When I look in the event log, I see this error message: Faulting application (App1) faulting module kernel32.dll, version 5.1.2600.5781.

I tried googling this but I didn't find anything that helped me.

Thanks
0
Comment
Question by:OFGemini
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36529864
Can you post an example of the arguments you pass to Process.Start? It sounds like App1 has an unhandled exception.
0
 

Author Comment

by:OFGemini
ID: 36529978
Hello,

Here is how I start App1.

Dim pathToApp1 As String = Path.Combine(Application.StartupPath, "App1.exe")
Process.Start(pathToApp1 )

I don't think its an issue w/ App1, b/c when I start App1 directly there is no problem.

Thanks

0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36530034
And there are no command-line arguments to App1?
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 36530184
Check to see if that file exists first and also try setting the WorkingDirectory:
Dim pathToApp1 As String = Path.Combine(Application.StartupPath, "App1.exe")
        If File.Exists(pathToApp1) Then
            Dim P As New Process
            P.StartInfo.FileName = pathToApp1
            P.StartInfo.WorkingDirectory = Path.GetDirectoryName(pathToApp1)
            P.Start()
        Else
            MessageBox.Show("App1 not found!")
        End If

Open in new window

0
 

Author Comment

by:OFGemini
ID: 36530437
Idle Mind, I'll try that, but what's the difference between your code and my code? Why does setting the workingDirectory make a difference?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 36530450
The 'Else' block is just a troubleshooting aid.

The WorkingDirectory() basically sets the current folder so that the executable can find any external local files that it expects to find in the same folder as the application.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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