-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[Bug]: WinUI/WAS - ReactiveUI.WinUi nuget attempts to load the ReactiveUI.XamForms assembly when WhenActivated is called on a IActivatableViewModel #3786
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
Comments
Are you breaking in on first-chance exceptions? This is expected but this exception should be handled |
No, I am not catching it on First-chance exceptions.
The error is getting raised up into my code, so apparently the Reactive Code is NOT properly handling that first exception.
Here is a screen shot of it happening in the example code at the top level of the project and as you can see it's percolating all the way up to the top level app code and not being handled / suppressed in the library ...
***@***.***
***@***.***
Matthew C. Hintzen [he-him-his] | Windows Washer
*
w - ***@***.******@***.***>
p - 321.234.8839
*
From: Ani Betts ***@***.***>
Sent: Tuesday, April 16, 2024 8:40 AM
To: reactiveui/ReactiveUI ***@***.***>
Cc: Matthew Hintzen ***@***.***>; Author ***@***.***>
Subject: Re: [reactiveui/ReactiveUI] [Bug]: WinUI/WAS - ReactiveUI.WinUi nuget attempts to load the ReactiveUI.XamForms assembly when WhenActivated is called on a IActivatableViewModel (Issue #3786)
Are you breaking in on first-chance exceptions? This is expected but this exception should be handled
-
Reply to this email directly, view it on GitHub<#3786 (comment)>, or unsubscribe<https://github.com./notifications/unsubscribe-auth/ACVGS2A33N3QR7D7QSLIAGDY5ULYVAVCNFSM6AAAAABGIC2WXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYHE4TIMZVGU>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
see if the following workaround prevents the issue. you need one of these in app initialisation before ReactiveUI is called. if you're not doing any custom Splat DI config.
if you're doing any custom config to Splat etc. you'll need something along the lines of. (you might want this version anyway so it's clearer when ReactiveUI is being set up)
If the Assembly scanning is the issue, this should prevent it. |
Thanks so much David,
I'll put that in as soon as I squash this current bug I'm working on, and let you know in the Git Issue if that fixed it!
***@***.***
Matthew C. Hintzen [he-him-his] | Windows Washer
*
w - ***@***.******@***.***>
p - 321.234.8839
*
From: David Vreony ***@***.***>
Sent: Tuesday, April 16, 2024 9:06 AM
To: reactiveui/ReactiveUI ***@***.***>
Cc: Matthew Hintzen ***@***.***>; Author ***@***.***>
Subject: Re: [reactiveui/ReactiveUI] [Bug]: WinUI/WAS - ReactiveUI.WinUi nuget attempts to load the ReactiveUI.XamForms assembly when WhenActivated is called on a IActivatableViewModel (Issue #3786)
see if the following workaround prevents the issue. you need one of these in app initialisation before ReactiveUI is called.
if you're not doing any custom Splat DI config.
ReactiveUI.PlatformRegistrationManager.SetRegistrationNamespaces(RegistrationNamespace.WinUI);
if you're doing any custom config to Splat etc. you'll need something along the lines of. (you might want this version anyway so it's clearer when ReactiveUI is being set up)
Locator.CurrentMutable.InitializeSplat();
Locator.CurrentMutable.InitializeReactiveUI(RegistrationNamespace.WinUI);
If the Assembly scanning is the issue, this should prevent it.
-
Reply to this email directly, view it on GitHub<#3786 (comment)>, or unsubscribe<https://github.com./notifications/unsubscribe-auth/ACVGS2CMJ4JRSLCQWNNFG4LY5UOZZAVCNFSM6AAAAABGIC2WXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZGA2DMNBUHE>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Thank you, that worked perfectly... hopefully anyone else coming across this bug will find this answer. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Describe the bug 🐞
In a WinUI 3 app project that has a dependency on the ReactiveUI.WinUI nuget package, if you add the
IActivatableViewModel
interface to a view model and implement the interface, then in the Constructor for that view model set up the WhenActivated Linq method in the constructor. When the Constructor is loaded, ReactiveUI raises an error of"Could not load file or assembly 'ReactiveUI.XamForms, Version=19.6.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified."
This is a bug, the XamForms assembly can not be referenced in a WinUI project, nor should it be needed
Step to reproduce
start a new WinUI 3 App - Blank project

Add A Class and cal it MainPageViewModel
on the main page add a Dependency property to the newly created MainPageViewModel
In the MainPage constructor, initialize the dependency property to a new instance of MainPageViewModel
Add ReactiveUI.WinUI nuget dependency to the project
Run the project, it runs fine
Stop Project.
Add the
IActivatableViewModel
interface to MainPageViewModel and implement it.Modify the constructor for the
MainPageViewModel
to be like so( this ).WhenActivated(disposables =>
with the error of
If you put a breakpoint i
Reproduction repository
https://github.com./xsgeek/ReactiveUI-WinUI-Bug
Expected behavior
The WinUI project should run just fine with just a reference to the ReactiveUI.WinUI assembly.
Screenshots 🖼️
No response
IDE
Visual Studio 2022
Operating system
Windows 11
Version
net7.0-windows10.0.22621.0
Device
Windows
ReactiveUI Version
19.6.1
Additional information ℹ️
No response
The text was updated successfully, but these errors were encountered: