Open
Description
Steps to reproduce
dotnet new fabulous-mauicontrols -n MauiExample.App
dotnet build
succeeds and the app can be run- Add the following properties to the fsproj
<WindowsPackageType Condition="$(TargetPlatformIdentifier) == 'windows'">None</WindowsPackageType>
<WindowsAppSdkUndockedRegFreeWinRTInitialize Condition="$(TargetPlatformIdentifier) == 'windows'">false</WindowsAppSdkUndockedRegFreeWinRTInitialize>
- Update
Main.fs
(manually initialize becauseWindowsAppSdkUndockedRegFreeWinRTInitialize
doesn't yet work out-of-the-box for F#, Can't build fsproj with WindowsPackageType=None microsoft/WindowsAppSDK#3663)
open System.Runtime.InteropServices
module private NativeMethods =
[<DllImport("Microsoft.WindowsAppRuntime.dll", CharSet = CharSet.Unicode, ExactSpelling = true)>]
extern int WindowsAppRuntime_EnsureIsLoaded()
[<AbstractClass; Sealed>]
type Initializer =
static member AccessWindowsAppSDK () =
NativeMethods.WindowsAppRuntime_EnsureIsLoaded ()
|> ignore // safe to ignore return value
module Program =
[<EntryPoint; STAThread>]
let main args =
Initializer.AccessWindowsAppSDK ()
do FSharp.Maui.WinUICompat.Program.Main(args, typeof<MauiExample.App.WinUI.App>)
0
- Add a launch profile to run it unpackaged
"Run App": {
"commandName": "Project"
}
- Run the project with a debugger attached
Expected
The app launches as it did in step 2
Actual
An exception is thrown
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Runtime.InteropServices.COMException (0x80004005): Unspecified error
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at WinRT.BaseActivationFactory._ActivateInstance[I]()
at WinRT.ActivationFactory`1.ActivateInstance[I]()
at Microsoft.UI.Xaml.Controls.XamlControlsResources..ctor()
at System.RuntimeType.CreateInstanceOfT()
--- End of inner exception stack trace ---
at System.RuntimeType.CreateInstanceOfT()
at System.Activator.CreateInstance[T]()
at Microsoft.Maui.Platform.ResourceDictionaryExtensions.AddLibraryResources[T](ResourceDictionary resources)
at Microsoft.Maui.Hosting.MauiAppBuilder.MauiCoreInitializer.<Initialize>g__SetupResources|0_1()
at Microsoft.Maui.Hosting.MauiAppBuilder.MauiCoreInitializer.Initialize(IServiceProvider services)
at Microsoft.Maui.Hosting.MauiAppBuilder.Build()
at MauiExample.App.MauiProgram.CreateMauiApp()
at MauiExample.App.WinUI.App.CreateMauiApp()
at Microsoft.Maui.MauiWinUIApplication.OnLaunched(LaunchActivatedEventArgs args)
at Microsoft.UI.Xaml.Application.Microsoft.UI.Xaml.IApplicationOverrides.OnLaunched(LaunchActivatedEventArgs args)
at ABI.Microsoft.UI.Xaml.IApplicationOverrides.Do_Abi_OnLaunched_0(IntPtr thisPtr, IntPtr args)
OS: Windows 10
Metadata
Metadata
Assignees
Labels
No labels