VS2015, Win10, C # WPF program.

If you click on a file that the program can “read” and select the item “Open with ...” in the context menu, the file starts to be associated with this program, but nothing happens (even the program does not start). If, after association, double-click to open the file, it opens as it should through the program.

I read that when "Open with ..." the path to the program is searched in the registry, I checked it in the registry. Why can't I open the file with this command right away?

Is there any way to debug this script?

UPD: I decided to make a conclusion in the text file of the argument that is passed to the program. The file is created and the correct path to the file being opened is written to it. So the program still runs, but not until the end.

  • What does "nothing happens"? What and what are you trying to associate with, and what do you expect at the same time? - VladD
  • Waiting: my program will open and the file specified in it. Reality: the program does not open, literally nothing happens. File association with my program is correct. - Sergey
  • Try to show an empty MessageBox at the beginning of the program’s run, while it is hanging, attach the debugger and see where it falls. - VladD
  • When I try to open a file through this command, the program comes to the MainWindow constructor, and then to MainWindow_Loaded (Loaded handler) does not go and it remains to hang in the background of the processes. - Sergey
  • And if you run from under Visual Studio with the same command line arguments? - VladD

1 answer 1

Put in the program properties, always run as administrator and it all worked.

UPD: It is enough to run the program once from the admin, just run the exe to which the path in the registry is specified.

  • one
    Uh ... Not the best solution. Do you happen to write files somewhere in the current directory or program directory somewhere? - VladD
  • Files is an archive which, in order to open in the program, must be unpacked into a temporary folder. And it is not necessary to put "Always from admin", it is enough to run the program once from the admin. - Sergey
  • By the way, it was the subscription to the unhandled exceptions that helped you find out. It's just that for the first time I probably messed up something. - Sergey
  • Strange, but what gave a single run from the admin? o_O - VladD
  • In any case, glad that helped! - VladD