Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reloading WPF XAML while debugging in Rider IDE?

Tags:

.net

wpf

xaml

rider

I am giving the JetBrains Rider IDE a try for Windows development with WPF. (I am on day 1 of my 30 day trial period.)

So, as I am running (debugging) my application, I notice that something is not right on the screen.

I open up the corresponding XAML file from within Rider, I edit it in a way that should result in a big visual difference, but nothing happens on the screen of my application. I save the XAML file from within Rider, still nothing happens on my application. I restart my application, then I see the changes.

With Visual Studio the XAML would be hot-reloaded every time I changed it, so I could see what I was doing without having to restart the application. It was buggy, but still better than nothing.

So:

  1. Does Rider have this feature at all?

  2. Is there some magic trick that enables it?

  3. I noticed that hot-reloading of XAML seems to be supported by Rider in the context of Xamarin, but I am doing WPF, so I assume that's irrelevant for me; is my assumption right?

  4. Is there any solution in DotNet for accomplishing the same thing programmatically? (E.g. I click a button on my app and my app somehow reloads its XAML.)

like image 487
Mike Nakis Avatar asked Jan 08 '20 17:01

Mike Nakis


People also ask

Does rider support hot reload?

Rider uses its own debugger technology to provide Hot Reload functionality. As such, it's independent from the dotnet-watch command-line tool (that you can use when working from the terminal).

Does JetBrains rider support WPF?

When creating a new project in Rider, we can select the WPF Application project type to start from. Just like with any other project template, we can configure a number of things like the solution and project name, the target framework and whether we want to create a source control repository at once.

How do I debug a XAML file?

To debug workflow XAMLRight-click the . xaml file that contains your workflow definition and select View Code. You will see a breakpoint displayed on the same line as the XAML element declaration of the activity that you set the breakpoint on in the design view. Invoke the debugger as described in Debug workflows.


Video Answer


2 Answers

For now, Rider does not support any XAML hot reload technologies.

In 2020.x, we are going to ship Xamarin Hot Reload feature. Related request: https://youtrack.jetbrains.com/issue/RIDER-22664

But for WPF, it is much trickier - it is impossible to 'replace' compiled markup on the fly in the running application (Xamarin.Forms does). So we have to build incremental diffs and apply them onto existing visual tree.

This is the most relevant issue for you: https://youtrack.jetbrains.com/issue/RIDER-26302

like image 55
xtmq Avatar answered Sep 21 '22 10:09

xtmq


As xtmq said Rider does not support any XAML hot reload technologies.

But if you would also appreciate this feature, you may upvote this on YouTrack: https://youtrack.jetbrains.com/issue/RIDER-26302

like image 21
BierDav Avatar answered Sep 21 '22 10:09

BierDav