Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the UWP crashes (continuing #216) #310

Closed
hanseuljun opened this issue Jan 22, 2021 · 3 comments
Closed

Fixing the UWP crashes (continuing #216) #310

hanseuljun opened this issue Jan 22, 2021 · 3 comments

Comments

@hanseuljun
Copy link
Contributor

Finally I had time to come back! So, which seemingly was a crash (see #216) was neither an actual crash or something caused by a missing dll. It was UWP by default expecting all applications to be GUI and complaining about the libdatachannel applications not having an "App" class with methods like OnLaunched, OnSuspending, and OnNavigationFailed in it!

So, the fix is stating the libdatachannel applications are not GUI but console. When running CMake to create a Visual Studio Solution, CMake auto-generates a package.appxManifest file per executable. To claim the executables are console, these appxManifest files need to be manipulated as below:

  1. Add two attributes to the tag
    xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
    xmlns:iot2="http://schemas.microsoft.com/appx/manifest/iot/windows10/2"

  2. Add four attributes to tags inside the tag.
    desktop4:Subsystem="console"
    desktop4:SupportsMultipleInstances="true"
    iot2:Subsystem="console"
    iot2:SupportsMultipleInstances="true"

This information comes from this website (https://docs.microsoft.com/en-us/windows/uwp/launch-resume/console-uwp) and attached is an appxManifest file modified for datachannel-benchmark provided as an example.
package.appxManifest.txt

The problem here is that I don't think CMake currently supports adding those attributes by a flag or something. So, to fix this UWP crashing issue, an approach would be adding the above attributes via XML manipulation. While I am not even sure XML manipulation can be done inside a CMake script, I will try it soon...

p.s. One positive thing I have learned is that actually your applications were working fine. The crashes happen after completely running main() and does not cause any actual problems. It was just having an error alerting window, which is terribly unappealing, at the end of execution.

@paullouisageneau
Copy link
Owner

Great to have you back on the UWP quest!

The problem here is that I don't think CMake currently supports adding those attributes by a flag or something. So, to fix this UWP crashing issue, an approach would be adding the above attributes via XML manipulation. While I am not even sure XML manipulation can be done inside a CMake script, I will try it soon...

You can't do XML manipulation, however you could try using configure_file to do variable substitution on an XML template.

@hanseuljun
Copy link
Contributor Author

Thanks for the suggestion! I'll come back to this hopefully by the end of this week.

paullouisageneau added a commit that referenced this issue Feb 4, 2021
Uwp fix (addressing #310 with the error dialog popping up)
@hanseuljun
Copy link
Contributor Author

As the way to support applications in uwp is now known, I will continue this line of work to support the examples... soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants