Bug 2773 - Console.WriteLine (null) crashes
Summary: Console.WriteLine (null) crashes
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2012-01-08 12:22 UTC by Jonathan Pobst
Modified: 2014-03-31 03:49 UTC (History)
4 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Jonathan Pobst 2012-01-08 12:22:03 UTC
The following code:

string a = null;
Console.WriteLine (a);

crashes with:

I/MonoDroid(26689): UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object

I/MonoDroid(26689): at System.IO.LogcatTextWriter.Write (string) <0x00048>

I/MonoDroid(26689): at System.IO.TextWriter.WriteLine (string) <0x00023>

I/MonoDroid(26689): at System.IO.SynchronizedWriter.WriteLine (string) <0x0005b>

I/MonoDroid(26689): at System.Console.WriteLine (string) <0x0002f>

I/MonoDroid(26689): at MonoAndroidApplication10.Activity1.OnCreate (Android.OS.Bundle) <0x0004f>

I/MonoDroid(26689): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x00057>

I/MonoDroid(26689): at (wrapper dynamic-method) object.185fa990-56b8-4b26-9a56-d6f8944d43dd (intptr,intptr,intptr) <0x00033>

E/mono    (26689): 

E/mono    (26689): Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object

E/mono    (26689):   at System.IO.LogcatTextWriter.Write (System.String s) [0x00000] in <filename unknown>:0 

E/mono    (26689):   at System.IO.TextWriter.WriteLine (System.String value) [0x00000] in <filename unknown>:0 

E/mono    (26689):   at System.IO.SynchronizedWriter.WriteLine (System.String value) [0x00000] in <filename unknown>:0 

E/mono    (26689):   at System.Console.WriteLine (System.String value) [0x00000] in <filename unknown>:0 

E/mono    (26689):   at MonoAndroidApplication10.Activity1.OnCreate (Android.OS.Bundle bundle) [0x00000] in <filename unknown>:0 

E/mono    (26689):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00000] in <filename unknown>:0 

E/mono    (26689):   at (wrapper dynamic-method) object:185fa990-56b8-4b26-9a56-d6f8944d43dd (intptr,intptr,intptr)

I/ActivityManager(   97): Process MonoAndroidApplication10.MonoAndroidApplication10 (pid 26689) has died.
Comment 1 Miguel de Icaza [MSFT] 2012-01-08 16:33:30 UTC
This is probably the new Console redirector that sends the output to he ADB log from JonP
Comment 2 Atsushi Eno 2012-03-29 05:24:53 UTC
Fixed.
Comment 3 Nischal 2014-03-31 03:49:04 UTC
We have checked and able to build and deploy android applications successfully.

Environment Info:
Xamarin Studio
Version 4.2.4 (build 266) 
Build Information
Git revision: 57fa6b7639703775ae1d5c46536e42ab424cb177
Xamarin addins: eee141c29724a19529e77b8e743086d95b29f5ba
Xamarin.Android 4.13.0-144 (MAC)
Xamarin.Android 4.13.0-04 (Win)