How to open html in code with opener

I want to open an HTML in code with an opener, code as follows, but I get an error saying that the resource provider for HTML is not registered. but I have already installed html preview extension. and when I use the context menu to open html in my application, it is ok. what happens when opening it with code?

@wss are you certain the the URI you are writing yourself in the code is correct?
The open with... > preview will use the proper URI from the selection in the explorer, and is likely the reason as to why it works correctly. In any case, you should be able to debug the feature locally as to why it may or may not work, and if the URI is in fact correct.