-
Notifications
You must be signed in to change notification settings - Fork 7
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
HotAvalonia breaks when a control references a private member #11
Comments
Since your view loses all child controls upon reload, I assume that some error tends to occur during its rehydration. Do you see any exceptions in the debug log? HotAvalonia sends all its logs there. If you do want to debug HotAvalonia yourself, that's possible, of course. Just take a look at how HotReloadDemo is set up: HotAvalonia/samples/HotReloadDemo/HotReloadDemo.csproj Lines 29 to 42 in fa137e5
|
Unfortunately, I do not see any errors on the Output > Debug window. This is my .csproj code: <!-- HotAvalonia -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>$(DefineConstants);ENABLE_XAML_HOT_RELOAD</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="Avalonia.Markup.Xaml.Loader" Version="$(AvaloniaVersion)" />
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="HotAvalonia" Version="1.1.1" />
<PackageReference Include="HotAvalonia.Extensions" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
<!-- End HotAvalonia --> |
I am seeing after a project rebuild
|
I don't think this is relevant to the current issue: |
From my project, I can access HotAvalonia's AvaloniaHotReloadContext.cs file. I put a breakpoint on: HotAvalonia/src/HotAvalonia/AvaloniaHotReloadContext.cs Lines 114 to 116 in fa137e5
Now I can see that when I click save I get the following error: Message
SerializationStackTraceString
StackTrace
|
I do have this code in my MainView.axaml.cs private void RootVisual_PointerWheelChanged(object? sender, PointerWheelEventArgs e)
{
if (e.KeyModifiers.HasFlag(KeyModifiers.Control))
{
var delta = e.Delta.Y;
Zoom(delta);
// Mark the event as handled
e.Handled = true;
}
} |
Looks like I have figured it out. Events such as the one above need to be Now I can see hot reload changes correctly |
Yup, unfortunately, this is a current limitation of The problem could be circumvented if For now, as you've already figured out, you can temporarily change the access modifiers on your events to |
Thank you very much for all your efforts and time. This library is life-changing |
Thanks a lot for the kind words! :) |
Maybe user can use a local modified Avalonia.Markup.Xaml.Loader to fix it. |
Technically, yes - HotAvalonia has a shadow dependency on
No, there is no such fork available. Thus, there's nothing to serve as a substitute for the original library. Avalonia folks don't seem interested in implementing this fix on their end, so I'll explore the possibility of incorporating it directly into HotAvalonia. |
It would be great if future versions could support private members, as there are usually many private event handlers in the project. |
Yeah, I know, it's a shame we currently have this limitation. Would love to get rid of it too! |
My HotReload works fine on many XAML usercontrols, but it does not work on my MainView.xaml usercontrol that contains the entire app. When I make a change to my MainView.xaml the whole screen turns gray. Is there a way for me to debug?
.NET: 8
Avalonia UI: 11.0.11
Visual Studio: 17.10.4
HotAvalonia: 1.1.1
Configuration: Debug
Platform: Any CPU
MainView.xaml header:
UI before changes
UI after saving a change
The text was updated successfully, but these errors were encountered: