Dmitriy Polyanskiy Dmitriy Polyanskiy - 2 years ago 92
C# Question

Chm file freeze the application when Url or Print buttons were clicked

When I open help file from my Windows Forms application I'm using this code.

public static void ShowHelp(string constant)
Help.ShowHelp(dummyFormForHelp.Value, CHMFile, HelpNavigator.Topic, constant);

It works fine except when I click on GO>URL... or Print button in the help file.

I get no messages and the app and chm file don't response at all. And I need go to task manager and kill the process. I have no idea what it is.

I tried to open the same file using the same code from the simple Windows Form application with only one form and everything was perfect. So I think something wrong in my application.

What can cause such issue?
It's a big enterprise application with a lot of screens.

Answer Source

First of all question is not quite clear described:

  • It should be mentioned that chm file is generated by NuHelp (it was temporary solution but we all know temporary is always permanent, huh?) )
  • dummyFormForHelp.Value says nothing here, it is just lazy initialized instance of form to prevent topmost position of help window and allow to switch between application and help

dummyFormForHelp.Value means:

private static readonly Lazy<Form> dummyFormForHelp = new Lazy<Form>(() =>
    var form = new Form();
    return form;

Back to original issues with WinForms<>CHM Help:

  • issues are appeared only if help is opened by application, if help is opened directly - no issues at all
  • endless loop is caught in 100% when navigating to URL, Print or typing any world in Search tab

Research shows that your issue with frozen application and opened chm is not unique:


Ways of resolving issue:

  • Try the last version of NuHelp
  • Try different converters and check if it can help
  • Do not use any converter and generate help file on your own
  • Start help as different process

Start help as different process:

hh is added to windows path, so such commands can be executed easily:

hh "help.chm::/topic.html"

hh "help.chm::/topic.html#subtopic"

hh -mapid 12345 help.chm

Drawback of workaround: each call of help from application will open new instance of help.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download