question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MvvmCross9.0.2 throws System.NullReferenceException for Bind

See original GitHub issue

🐛 Bug Report

System.NullReferenceException: “Object reference not set to an instance of an object.” at MvvmCross.Binding.BindingContext.MvxBaseFluentBindingDescription1.SourcePropertyPath[TSource](Expression1 sourceProperty)\n
at MvvmCross.Binding.BindingContext.MvxFluentBindingDescription2.To(Expression1 sourceProperty)

Note:MacOS App migrated from Xamarin.Mac to. NET6

Expected behavior

MacOS App starts up normally

Reproduction steps

Create binding set and call bind. Screen Shot 2022-12-22 at 16 59 25

Sample Source Code: MvvmCross.NETSample.Mac.zip

Configuration

・Visual Studio for Mac 17.5 ・MvvmCross 9.0.2

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
snechaevcommented, Feb 10, 2023

@dingyud it looks like you hit by this bug https://github.com/MvvmCross/MvvmCross/issues/4572 Try to set any of presentation attributes (I suppose, the [MvxWindowPresentation] will be the best here) explicitly to your view / view controller to workaround this.

1reaction
Cheesebaroncommented, Jan 10, 2023

Seems like what is happening is that you have your standard Main.storyboard, which shows the ViewControler before MvvmCross has initialized. So it is not MvvmCross pushing the ViewController.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullReference exception during binding with MvvmCross
I ran into the same problem using Views generated from code. The Viewmodel is set, but the bindingcontext is not completely set. Here...
Read more >
Upgrade to 8.0.2 throws System.ReferenceNullException ...
Throws System.ReferenceNullException "Object reference not set to an instance of object" for setting bind after CreatBindingSet() ...
Read more >
NullReferenceException when building Xamarin Android ...
I've been trying to build a Xamarin Android Binding Library having a .jar file in it. It builds just as expected with different...
Read more >
Why am I getting a null reference exception for ASP.NET ...
Normally, we bind all "Applicant model" details to the Applicant view page, and some fields have data while others do not. It should...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found