none
the application has failed to start because the application configuration is incorrect

    Question

  • I have seen many similar posts, but they don't answer my question.  They mostly seem to pertain to Visual C++ projects, and the language I am using is Visual C#.  I got this error when I deployed files manually to a target machine for a console application.  Here are the details:

    1. I built this app in Visual Studio 2010.  The solution consists of one console application project and 3 class library projects.

    2.  The target framework is .NET Framework 3.5.

    3.  Based on what I found on the web, I tried installing the Visual C++ redistributable files (I tried BOTH methods described here:  http://msdn.microsoft.com/en-us/library/ms235316%28VS.80%29.aspx ); I am fairly certain I performed all steps correctly.  I still get the error when I try to launch my app.

    4.  I would like to create a setup project and just check the boxes for the .Net framework 3.5 and the Visual C++ runtime modules, but that is not possible in my situation; because of security policies, the target machine has no internet connection, and therefore I cannot simply run my installer and have it download and install the appropriate dependent files. 

    So my questions are:

    a) why, as many have also wondered, is this error message so cryptic?  Why can it not simply tell you what file(s) are missing, so the developer can troubleshoot the problem?

    b) what is the actual problem, and how do I solve it?

    c) why is there no easy way, within Visual Studio 2010, to do something like Dependency Walker, where the developer can simply know, with certainty, what files are required to run their application on a target computer?  Why does one have to go through this process of building the app, deploying the files, discovering there's something missing, and then having no idea what the missing component(s) might be?

    d) Could the error have something to do with an incorrect installation of the .Net framework 3.5 on the target computer? 

    Any help appreciated.  Thank you.

    Dave

     

     

    Wednesday, September 01, 2010 12:46 PM

Answers

  • In the end it turns out this was caused by bad XML in the app config file (i.e. in my case, "Launcher.exe.config").  If you've got bad XML in your config file, you will get the cryptic messages described above.  In this case the message in the system event log was misleading, because it says "Manifest" when there was actually no manifest for this application.  It was the app.config file itself.  It would sure be nice if the actual error message you got was "bad XML in app.config file" or something to that effect; THAT is really what's happening when you get this message.  Hopefully this post will help someone in the future.

     

    Monday, September 13, 2010 2:06 PM

All replies

  • Hi Dave,

    Could you please provide detailed steps to reproduce the issue? I am a little confused about your description.

     

     

    Best regards,

    Guang-ming Bian

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Thursday, September 02, 2010 10:04 AM
  • Hello, thanks for your reply.

     

    1. Created an application in Visual Studio 2010.  My dev machine is running Windows Vista 64 bit.

    Language = C#

    Target framework = .Net framework 3.5.  Build = "Release", Mixed Platforms (the code analysis tab for the console app shows platform Active (x86).  The class library project properties show "Active (any cpu)"  The platform target is Any CPU).

    Solution consists of a console application, which is the startup project, and 3 class libraries.

    When the app gets built (Release version), there are the following files in the bin\Release folder

    ClassLib.dll (the output from the build of one of my class libraries)

    Data.dll (the output from the build of one of my class libraries)

    XmlSerializers.dll (apparently auto-generated by visual studio)

    Diagnostics.dll (the output from the build of one of my class libraries)

    Launcher.exe (the output from the build of the console application)

    Launcher.exe.config (the config file for the console application)

    log4net.dll (a 3rd party library)

     

    2. I manually copy, via my customer's VPN, the above files from the bin\Release directory, to the target machine.  The target machine is running Windows Server 2003.

    3. When I try to run Launcher.exe, I get the error message.

     

     

    Friday, September 03, 2010 9:18 AM
  • Incidentally, the "Event Viewer" under Computer Management... System Tools... Event Viewer... System shows the following error, where the Source is "SideBySide":

    Generate Activation Context failed for <pathToTheExe>Launcher.exe.  Reference error message:  Manifest Parse Error:  Incorrect syntax was used in a comment.

     

    Friday, September 03, 2010 9:22 AM
  • Further information:  I have now tried this on two machines at the customer site, both Windows Server 2003 machines.  The 2nd machine DOES have an internet connection, so I downloaded and installed both the .Net 3.5 framework and the Visual C++ 2010 redistributable package.  Same error (see the Event Viewer information I posted above).  The system seems to be complaining about incorrectly formatted XML in a manifest file, but this application does not have a manifest.  I'm not sure why that should be necessary.  Please help.  Thanks

     

    Dave

     

    Friday, September 03, 2010 10:04 AM
  • Still more:

    I have now successfully run the app in our environment on a Windows Server 2003 machine.  So the problem has nothing to do with the app itself; I have proven that it can run on a similar box (albeit possibly different service packs, etc).  Could it be some permissions issue or something?

     

     

    Friday, September 03, 2010 10:42 AM
  • FYI:  all 3 machines are running Windows Server 2003 Enterprise Edition, SP2

     

    Friday, September 03, 2010 12:18 PM
  • Hi DavidBarrows,

    Sorry for my late reply because of weekend. It looks OS environment change cause the issue. I recommend you use a tool named Cordbg.exe, which helps tools vendors and application developers find and fix bugs in programs that target the .NET Framework common language runtime. This tool uses the runtime Debug API to provide debugging services.

    Fore how to use the tool to debug:
    http://msdn.microsoft.com/en-us/library/a6zb7c8d(VS.80).aspx

    If you still can't solve it with the tool, could you create a dump file about the application and send to me, here is how to get dump file:
    http://msdn.microsoft.com/en-us/library/d5zhxt22.aspx

    Above link also provide how to debug with dump file, you can also have a try.

    Best regards,
    Guang-Ming Bian - MSFT


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Tuesday, September 07, 2010 6:55 AM
  • Hello, thank you for your reply.

    - where is cordbg.exe ?  How do I download it?  There is nothing on MSDN to indicate where a developer can actually find this .exe file.

    Extensive web searching does not answer this question.  Some blogs suggest it may be in the Windows SDK.  I downloaded that and still could not find it on my hard drive.  Would it be possible for Microsoft to update the page about cordbg.exe to tell people where they might actually find or obtain cordbg.exe?

    - I appreciate what you're saying about how it appears to be an environmental issue.  I agree that seems to be true because the application works in our environment, which also is running Windows Server 2003 Enterprise SP2, just like at the customer's site.  However, can you provide any insight as to the nature of the two error messages:

    "The application has failed to start because the application configuration is incorrect"

    and the one in the Event Log that occurs when the first error is displayed:

    "Generate Activation Context failed for <pathToTheExe>Launcher.exe.  Reference error message:  Manifest Parse Error:  Incorrect syntax was used in a comment."

    Specifically my questions are:

    1. what about the environment could possibly cause these errors?

    2. if I were to manage to find and/or download cordbg.exe, how would I use it to understand what is causing these errors?  Would I dump its output to a file?  Presumably, when my EXE runs, it is, at some point, hitting some line of code that it doesn't like, or where some environmental condition is causing it to think there is a bug in a program which runs fine in other environments.  I assume we are trying to understand what line of code is causing the application to fail.  Can you give me any suggestions as to how I might use cordbg.exe to find out?

    Any information you can give me specifically in response to these two questions would be helpful.  Thank you,

    Dave

     

     

     

     

    Tuesday, September 07, 2010 9:56 AM
  • Hi Dave,

    If you install vs2005, it will in following folder:
    C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

    VS2008 will be the same folder. Please check it.

    Fow how to use it:
    http://msdn.microsoft.com/en-us/library/a6zb7c8d(VS.80).aspx#cpgrfruntimedebuggercordbgexeanchor4

     

    Best regards,

    Guang-ming Bian

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Tuesday, September 07, 2010 10:29 AM
  • Hi Guang-ming,

    I've got Visual Studio 2005, 2008, and 2010 all installed on my machine.  That doesn't exist in the Bin folder of any of those installations.

    thanks


    Dave

     

    Tuesday, September 07, 2010 11:38 AM
  • Hi Dave,

    If you can't get the tool, could you provide the dump file when you get the exception? For how to get it, please see my previous reply.

     

    Best regards,

    Guang-ming Bian

    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    Wednesday, September 08, 2010 5:43 AM
  • Thanks, I am waiting for the client to do some troubleshooting of their own, in their environment.  I will get back to you.  Thanks for your help,

     

    Dave

     

    Wednesday, September 08, 2010 11:29 AM
  • In the end it turns out this was caused by bad XML in the app config file (i.e. in my case, "Launcher.exe.config").  If you've got bad XML in your config file, you will get the cryptic messages described above.  In this case the message in the system event log was misleading, because it says "Manifest" when there was actually no manifest for this application.  It was the app.config file itself.  It would sure be nice if the actual error message you got was "bad XML in app.config file" or something to that effect; THAT is really what's happening when you get this message.  Hopefully this post will help someone in the future.

     

    Monday, September 13, 2010 2:06 PM
  • I had a similar problem. In my app config I had accidentally put an extra quote " in after a parameter value eg

    <add key="Password" value="anon@anon.com"" />

    The answer provided by David was helpful in pointing me at the app.config instead of looking for some manifest file. After I removed the extra quote I can run my application.

    Thanks.

     

    Friday, May 20, 2011 12:19 AM