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

Hot reload doesn't work with WinUI 3 #7043

Closed
2 tasks
kostya9 opened this issue May 1, 2022 · 11 comments
Closed
2 tasks

Hot reload doesn't work with WinUI 3 #7043

kostya9 opened this issue May 1, 2022 · 11 comments
Labels
bug Something isn't working product-winui3 WinUI 3 issues team-Markup Issue for the Markup team

Comments

@kostya9
Copy link

kostya9 commented May 1, 2022

Describe the bug

C# hot reload doesn't work with the default WinUI 3 project

Steps to reproduce the bug

  1. Create new WinUI3 project
  2. Run in Debug mode and (Packaged) configuratoion
  3. Try to edit the button content assignment to other text
  4. Click hot reload

Actual: Error message box with text "Hot Reload can't ..."

Expected behavior

Hot reload is successful

Screenshots

image

NuGet package version

WinUI 3 - Windows App SDK 1.1 Preview 2: 1.1.0-preview2

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

Windows 11 (21H2): Build 22000

Additional context

Tried Visual Studio 2022 17.1, Visual Studio 2022 17.2 Preview 5.0
Tried .NET 6, .NET 7 preview
Tried Microsoft.WindowsAppSDK Versions 1.0.0, 1.0.3, 1.1.0-preview2

Cannot try with "Unpackaged" configuration since it throws "Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)" on startup (#6377)

@kostya9 kostya9 added the bug Something isn't working label May 1, 2022
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label May 1, 2022
@castorix
Copy link

castorix commented May 1, 2022

It works fine for me : WinUI 3, Windows App SDK 1.1.0-preview2, Windows 10 21H1.
Test Unpackaged app :

HotReload_Options

WinUI3_HotReload

@kmgallahan
Copy link
Contributor

kmgallahan commented May 1, 2022

XAML hot reload is mostly reliable outside of bindings.

C# hot reload sometimes works, but you must do step 2 here.

Make sure that Enable native code debugging is disabled in the debugger settings or the debug launch profile.

Other unsupported scenarios

@kostya9
Copy link
Author

kostya9 commented May 2, 2022

I think I figured it out...

@kmgallahan thanks for the pointer

VS Debug profile says that native debugging is disabled, but it didn't allow hot reloading for some reason.

However, as soon as I added "nativeDebugging": false to the launchSettings.json, the C# hot reloading feature started working.

{
  "profiles": {
    "WinUi3App (Package)": {
      "commandName": "MsixPackage",
+     "nativeDebugging": false
    },
    "WinUi3App (Unpackaged)": {
      "commandName": "Project"
    }
  }
}

It seems like there are some synchronisation issues between the VS Debug Properties and what is actually used to run the app.

@ojhad ojhad added team-Markup Issue for the Markup team product-winui3 WinUI 3 issues labels May 4, 2022
@marb2000
Copy link
Contributor

marb2000 commented May 6, 2022

Actually, XAML Hot Reload doesn't work with succinct RowDefinition:

<Grid RowDefinitions="Auto, Auto, *, Auto">

@heartacker
Copy link

heartacker commented Aug 12, 2022

I have the same issue.
And I had try to using Unpackaged launch config ,but I face the error #6377 (comment)

@jpgarza93
Copy link

jpgarza93 commented Nov 7, 2022

Removing this did it for me.

Actually, XAML Hot Reload doesn't work with succinct RowDefinition:

<Grid RowDefinitions="Auto, Auto, *, Auto">

wow

@lukasf
Copy link

lukasf commented Nov 9, 2022

It seems to be a problem in WinUI 3: #673

@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Dec 6, 2022
@AMArostegui
Copy link

In my case, XAML hot reload only works when running a x86 application, not for x64 or Any Cpu configurations

@manusoft
Copy link

Actually, XAML Hot Reload doesn't work with succinct RowDefinition:

<Grid RowDefinitions="Auto, Auto, *, Auto">

Remove RowDefinitions it works.. great!

@Reza-Noei
Copy link

Thanks @marb2000 it worked for me too !

But it's a bug actually, Any plan to resolve it ?
Because it saves my time and reduces a lots of spaces in the code.

@evelynwu-msft
Copy link
Contributor

Original issue is solved (#7043 (comment)), known limitation in C# hot reload, unrelated to WinUI 3. Subsequent comments are duplicate reports of #5944.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product-winui3 WinUI 3 issues team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests