none
Can't run an app from a UNC but it runs from the same location when mapped to a drive letter RRS feed

  • Question

  • I have a dotnet app I want to run from the network.  It uses framework 3.51.

    When I create a shortcut pointing to a mapped drive letter it runs as expected.

    Shortcut target is "Z:\Programs\MyApp\MyApp.exe"

    If the shortcut points to a UNC I get the following error.

    Shortcut target is "\\MyServer\Apps\Programs\MyApp\MyApp.exe"

    System.TypeInitializationException: The type initializer for 'main' threw an exception. ---> System.Management.ManagementException: Not found
       at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
       at System.Management.ManagementObject.Initialize(Boolean getObject)
       at System.Management.ManagementBaseObject.get_Properties()

    At this point I can choose continue and the program launches but is missing some info from program settings that allow the applicaqtion to operate corectly.

    Any ideas what I might be able to do to resolve this?

    Thanks

    • Moved by Amanda Zhu Monday, February 11, 2013 3:35 AM
    Friday, February 8, 2013 4:21 PM

Answers

  • The problem probably come from the fact that when you launch an application from Z: drive, the Z:\Programs\MyApp\ path become the current directory of your application. This isn't the case when you launch from an UNC drive.

    The problem can also come from rights restrictions for .NET applications when not launched from the computer hard drive (sometime you .NET assume that UNC path aren't in your Windows Network Domain depending on the client computer OS and its effective membership or not of the network Domain)

    As you can see, the "Not Found" management exception is an inner exception of your 'main' class constructor.

    To make debuging easier, move the initialization of the 'main' class members in the 'Main()' or 'Run()' function. This will help you to read the exception and to understood the "Not Found" message. If the debugger displays the TypeInitializationException, open the InnerException to see if it contains more informations.

    For more help, please provide minimal main class source code that fire this exception and specify the kind of executable you use WinForms, Console, WPF ...

    Wednesday, February 13, 2013 10:48 PM

All replies

  • Hello GOMCK,

    Thank you for posting in MSDN forum.

    Based on your description, I feel that your issue is more related to .NET Base class library and CLR. I have moved this thread to .NET Framework Class Libraries forum for better response.

    Best regards,

     


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 11, 2013 3:35 AM
  • The problem probably come from the fact that when you launch an application from Z: drive, the Z:\Programs\MyApp\ path become the current directory of your application. This isn't the case when you launch from an UNC drive.

    The problem can also come from rights restrictions for .NET applications when not launched from the computer hard drive (sometime you .NET assume that UNC path aren't in your Windows Network Domain depending on the client computer OS and its effective membership or not of the network Domain)

    As you can see, the "Not Found" management exception is an inner exception of your 'main' class constructor.

    To make debuging easier, move the initialization of the 'main' class members in the 'Main()' or 'Run()' function. This will help you to read the exception and to understood the "Not Found" message. If the debugger displays the TypeInitializationException, open the InnerException to see if it contains more informations.

    For more help, please provide minimal main class source code that fire this exception and specify the kind of executable you use WinForms, Console, WPF ...

    Wednesday, February 13, 2013 10:48 PM