Skip to content

HelpAttribute behaviour for .NET Core 2.1 and higher is inconsistent #141

@popfra

Description

@popfra

Hello XCad team,

I try to apply a HelpAttribute like ([Help("C:\SWX_Addin\Help\Test.chm")], [Help("C:\SWX_Addin\Help\Test.txt")], [Help("https://www.google.com/")] or [Help("https://8.8.8.8")]) on my PropertyPage which always throws "Help link is not available" message. I checked your code base and found following issue due to a breaking change on Microsoft side see https://learn.microsoft.com/en-us/dotnet/core/compatibility/fx-core#net-core-21

They address here that the call System.Diagnostics.Process.Start(link); now needs something with .exe in case UseShellExecute is false which they changed to be default on .NET Core 2.1 and higher.

All following lines work on a separate Action on a PMPage:
Process.Start(new ProcessStartInfo("C:\SWX_Addin\Help\Test.chm") { UseShellExecute = true });
Process.Start(new ProcessStartInfo("C:\SWX_Addin\Help\Test.txt") { UseShellExecute = true });
Process.Start(new ProcessStartInfo("https://www.google.com/") { UseShellExecute = true });
Process.Start(new ProcessStartInfo("https://8.8.8.8/") { UseShellExecute = true });

For a future build could you add a HelpOptionsAttribute to address following call:

	var helpFileStartInfo = new ProcessStartInfo()
	{
		FileName = "C:\\Windows\\hh.exe",
		Arguments = "mk:@MSITStore:C:\\SWX_Addin\\Help\\Test.chm::/C_About_Card_Editor.htm",
		WindowStyle = ProcessWindowStyle.Maximized,
		UseShellExecute = true
	};

	Process.Start(helpFileStartInfo);

At the moment I have to use Reflection to clear invocation list of your implemented event "HelpRequested" and to add my own handler method to "HelpRequested" which than is called.

Full discussion on this and tries to fix it on XCad discord see https://discordapp.com/channels/915451168518447104/915452518195167272/1375830964386664678 see questions channel.

I'm using currently .Net 6 with following nuggets Xarial.XCad, Xarial.XCad.SolidWorks and Xarial.XCad.Toolkit all with version 0.8.2

Best regards

popfra

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions