[uwp] NullReferenceException, then XamlParseException: Cannot create instance of type...
See original GitHub issueDescribe the bug
For some user control classes, I can’t create them in xaml, an error (actually two) gets thrown. at this.InitializeComponent()
For additional context, I get this error during startup:
Steps to reproduce the bug
This is a weird bug, and my app is really big, and it only happens on some user controls and not others, but I can’t figure out what separates the classes with the problem.
My MainPage
looks like this:
My select_sound_effect_ctrl
xaml looks like this:
At startup: First I get
Then I get
It basically says it can’t create an instance of type select_sound_effect_view_model
, but I don’t understand why. It’s a public
class, and as matter of fact, this works (just creating it in code):
Once again, if I leave the class as it originally is, and I create an instance in code-behind, it works:
Expected behavior
Clearly, the error shouldn’t happen. This occurs at random times, code that once worked, sometimes stops working after months. And sure, it’s rather simple to create a control in code every now and then, but what when it’s used in a more complicated scenario, like, have an ItemsControl
of such items?
Windows 10 version | Saw the problem? |
---|---|
May 2020 Update (19041) | Yes |
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
Thanks for filing this, since this is a XAML issue, transferring to the WinUI XAML repo.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.