0

I have an C# .NET app that I tried packaging both as appxbundle and msix to use as a Kiosk application. Both works when launched normally but fails to load when run after setting up assigned access. I used "Set-AssignedAccess" to set it up. There are no error logs being created, I have added logs pretty much everywhere. I have also added the certificates to trusted root certs.

It is outputting the entire applications debug log for startup. Which leads me to believe no errors are being thrown causing the app to crash.

It also creates a "config.json" file which should only be created if the React app hosted in the webview2 calls an API to get config and the file doesn't exist(expected on first launch). This confirms both my react app hosting, and hosting works for port 5050.

IMPORTANT: I am getting the same issue with only a text block app(code below). Created fresh with no other changes to speak of. Any changes from standard template(other than the text block itself) was made to try and fix the issue.

Some additional info:

Screenshot of app running in normal launch(Not kiosk)

I have

  • asp .net core apis

  • reverse proxy

  • react app hosted for Webview2

  • Launching Tabtip.exe for touch input. This only happens on input focus.

    App.xaml.cs:

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices.WindowsRuntime;
    using Microsoft.UI.Xaml;
    using Microsoft.UI.Xaml.Controls;
    using Microsoft.UI.Xaml.Controls.Primitives;
    using Microsoft.UI.Xaml.Data;
    using Microsoft.UI.Xaml.Input;
    using Microsoft.UI.Xaml.Media;
    using Microsoft.UI.Xaml.Navigation;
    using Microsoft.UI.Xaml.Shapes;
    using Windows.ApplicationModel;
    using Windows.ApplicationModel.Activation;
    using Windows.Foundation;
    using Windows.Foundation.Collections;
    
    // To learn more about WinUI, the WinUI project structure,
    // and more about our project templates, see: http://aka.ms/winui-project-info.
    
    namespace Blank_text_box
    {
    
        public partial class App : Application
        {
            private Window? _window;
    
            public App()
            {
                InitializeComponent();
            }
    
    
            protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
            {
                _window = new MainWindow();
                _window.Activate();
            }
        }
    }
    
    

    App.xaml:

    <?xml version="1.0" encoding="utf-8"?>
    <Application
        x:Class="Blank_text_box.App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:Blank_text_box">
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
                    <!-- Other merged dictionaries here -->
                </ResourceDictionary.MergedDictionaries>
                <!-- Other app resources here -->
            </ResourceDictionary>
        </Application.Resources>
    </Application>
    
    

Mainwindow.xaml.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.Foundation;
using Windows.Foundation.Collections;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace Blank_text_box
{
    /// <summary>
    /// An empty window that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

Mainwindow.xaml:

<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="Blank_text_box.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Blank_text_box"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="Blank_text_box">

    <Window.SystemBackdrop>
        <MicaBackdrop />
    </Window.SystemBackdrop>

    <Grid>
        <TextBlock Text="HELLO KIOSK"
               Foreground="White"
               FontSize="72"
               HorizontalAlignment="Center"
               VerticalAlignment="Center"
               TextAlignment="Center"/>
    </Grid>
</Window>

I also generated a self signed certificate and used that .pfx when signing the app package.
The ".msixbundle" file was generated, the folder also contained the ".cer" file which i installed to trusted store and trusted people. It shows up a "SignatureKind: Developer"(I dont know if this is an issue)

The Above code is not my original code, this is a demo code which also has the same exact issue of blackscreen and windows error "ding" on mouse click input(left and right clicks).

6
  • Did you enable logging for kiosk issues, as in the tip in Troubleshoot kiosk mode issues? Although that tip seems to suggest that you would need to create a different program to test with: "For some failures, events are only captured once. If you enable logging after an issue occurs with your kiosk, the logs may not capture those one-time events." Hopefully that doesn't mean you have to go so far as to do a clean install of Windows to see the event(!) Commented Sep 5 at 15:33
  • Also, Remote Debugging is available, if you think that might help. Commented Sep 5 at 15:38
  • What defines "kiosk mode"? In our case, one had to open the cabinet, plug in a keyboard, and sign in to get any other type of access ... where the full screen touch only mode was limited to "the app". Commented Sep 5 at 18:25
  • @AndrewMorton "For some failures, events are only captured once. If you enable logging after an issue occurs with your kiosk, the logs may not capture those one-time events.". This made no sense to me when i read it.The failure is happening repeatedly.Why would it only be logged once.Everytime i open the windows user with kiosk setup it breaks, so i expect it to log whatever it is multiple times.I am mostly convinced its a rendering issue(compositor failing to draw) now as the app(even though not visible) is giving all the logs if it runs. Possibly, Assigned Access compositor works differently Commented Sep 7 at 7:04
  • @GerrySchmitz By Kiosk mode, I meant using "Set up as Kiosk" in the user settings, or "Assigned Access" when you do it programmatically. Idea being the shell is replaced with your application. One of the solutions i found was to run explorer.exe(default windows shell) and then make it open your application. Issue with this was that this also comes with all the windows shortcut keys and lot of unnecessary headaches, like app crashes or windows crashes might let users access the system. I expected assigned access to work easily, and it does seem to, but something I missed is breaking it Commented Sep 7 at 7:10

1 Answer 1

0

Ok, I abandoned this method. Seems doing this means the below scenario

Explorer normally initializes the compositor and shell-related WinRT services, which Assigned Access doesn’t when you replace it with a custom app.

so UI wont load I guess.

So i went with the other method of replacing "explorer.exe" with my app

Replace Explorer with your app for a dedicated kiosk account. Do this as admin user

    1. Create a separate kiosk/local user.

    2. Get users SID using Powershell
        
        Get-LocalUser -Name "<Username>" | Select-Object SID

    2. Set your app as the shell: Change the path to install location.

        reg add "HKU\<SID>\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "C:/Path/to/your/app" /f


    3. Log in as that user → Windows launches only your app.

Special case: If the registry key doesn't exist for the user, you can load it as temporary hive as follows and do it.

    1. Load the hive
        reg.exe load HKU\TempHive "C:\Users\<Username>\NTUSER.DAT"

    2. Add the key/value
        reg.exe add "HKU\TempHive\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" --% /v Shell /t REG_SZ /d "C:/Path/to/your/app" /f

    3. Unload the hive
        reg.exe unload HKU\TempHive

similiarly you can run below commands to reassign explorer.exe

reg add "HKU\<SID>\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "explorer.exe" /f

or

reg.exe add "HKU\TempHive\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" --% /v Shell /t REG_SZ /d "explorer.exe" /f
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.