Bug 14520 - NullReferenceException is raised on casting null to any type in some cases if using MvvmCross
Summary: NullReferenceException is raised on casting null to any type in some cases if...
Status: RESOLVED DUPLICATE of bug 14552
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime (show other bugs)
Version: 6.4.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-09-07 17:33 UTC by Ievgen
Modified: 2013-09-20 10:21 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Ievgen 2013-09-07 17:33:23 UTC
After upgrading to a new STABLE version 6.4.4.12 my project (based on MvvmCross) went nuts with Null pointer exceptions. It seems that any code with strict casting produces the exception in runtime:

(MyType)myVariable;

where myVariable is null at the moment. The walk around is to use

myVariable as MyType;

But this is totally not worth it in scope of the big project.

MvvmCross applied a quick solution for some places in there Framework https://github.com/slodge/MvvmCross/issues/418, but again it doesn't work for everything else in my project.
Comment 1 Sebastien Pouliot 2013-09-07 17:41:16 UTC
Not sure I understand. That above pattern is used everywhere inside our code (both the BCL on monotouch.dll) and it works fine in our test suites, applications and samples.

Please attach a self-contained test case showing the issue and all the software versions being used.

The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Comment 2 Ievgen 2013-09-07 17:53:54 UTC
Yes, you are right. My description is wrong since it indeed works for the example I mentioned but it doesn't work in other cases that I am trying to extract as a separate example now.

BTW is there a quick way to get back previous version in Stable branch? I am really low on time solving this random exceptions and I need to get back working environment ASAP :-(

Please read the link https://github.com/slodge/MvvmCross/issues/418. It seems your team might be aware about the problem according to Slodge's mentions.

My version:

Xamarin Studio
Version 4.0.12 (build 3)
Installation UUID: 2092999b-cea1-4240-8a64-5170c0a5c514
Runtime:
	Mono 3.2.0 ((no/7c7fcc7)
	GTK 2.24.20
	GTK# (2.12.0.0)
	Package version: 302000000

Apple Developer Tools
Xcode 4.6.3 (2068)
Build 4H1503

Xamarin.Mac
Xamarin.Mac: Not Installed

Xamarin.Android
Not Installed

Xamarin.iOS
Version: 6.4.4.12 (Indie Edition)
Hash: 62e07d5
Branch: 
Build date: 2013-26-08 14:21:47-0400

Build Information
Release ID: 400120003
Git revision: 593d7acb1cb78ceeeb482d5133cf1fe514467e39
Build date: 2013-08-07 20:30:53+0000
Xamarin addins: 25a0858b281923e666b09259ad4746b774e0a873

Operating System
Mac OS X 10.8.4
Darwin silverbox.local 12.4.0 Darwin Kernel Version 12.4.0
    Wed May  1 17:57:12 PDT 2013
    root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
Comment 4 Sebastien Pouliot 2013-09-07 19:13:51 UTC
You can download past releases from your account
https://store.xamarin.com/account/my/subscription/downloads
Comment 5 Sebastien Pouliot 2013-09-08 10:44:04 UTC
Do you remember if the NRE occured:

* only occured on the simulator ?

or

* did the same happen on devices ?
Comment 6 Sebastien Pouliot 2013-09-20 10:21:32 UTC
I'm assuming this is a duplicate of #14552. If you can still duplicate this with 6.4.5+ please re-open and attach a test case.

*** This bug has been marked as a duplicate of bug 14552 ***

Note You need to log in before you can comment on or make changes to this bug.