Bug 59577 - Crash on access to field in structure
Summary: Crash on access to field in structure
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2017-09-19 12:06 UTC by Slava Osipov
Modified: 2017-09-19 15:00 UTC (History)
2 users (show)

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

Sample project (35.49 KB, application/x-zip-compressed)
2017-09-19 12:06 UTC, Slava Osipov
Build environment (3.98 KB, text/plain)
2017-09-19 12:08 UTC, Slava Osipov

Description Slava Osipov 2017-09-19 12:06:56 UTC
Created attachment 24812 [details]
Sample project

I'm facing a NullReferenceException when trying to write to a structure's field of 'double' type. If type of field in 'long' or 'int' in same case - no NRE occured and app works as expected.
Project built in Visual Studio 2015 and executed on real Android device. 
See attached sample project . Run app and tap message to reproduce crash.
Comment 1 Slava Osipov 2017-09-19 12:08:01 UTC
Created attachment 24813 [details]
Build environment
Comment 2 Slava Osipov 2017-09-19 12:08:49 UTC
Details of Android device:
CPU Architecture: ARMv7 Processor rev 0 (v7l)
Board: msm8916
Chipset: Qualcomm Technologies, Inc MSM8916
Cores: 4
Clock Speed: 800 MHz - 1209 MHz
Instruction Sets: armeabi-v7a, armeabi
CPU Features: swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
CPU Governor: interactive
Kernel Version: 3.10.28
Kernel Architecture: armv7l
Comment 3 Slava Osipov 2017-09-19 12:11:47 UTC
Details of Android device (continue):
OS Version: Kitkat (4.4.4)
SDK: 19
Comment 4 Jon Douglas [MSFT] 2017-09-19 15:00:57 UTC
Here is output from this error:

09-19 11:45:51.551 I/MonoDroid(21421): UNHANDLED EXCEPTION:
09-19 11:45:51.602 I/MonoDroid(21421): System.NullReferenceException: Object reference not set to an instance of an object
09-19 11:45:51.602 I/MonoDroid(21421):   at StructTest.Factory.CreateWrong () [0x00010] in <3b6c85a299c045ca9da07bf7c723a49b>:0 
09-19 11:45:51.602 I/MonoDroid(21421):   at StructTest.MainActivity+<>c__DisplayClass1_0.<OnCreate>b__0 (System.Object <p0>, System.EventArgs <p1>) [0x0003b] in <3b6c85a299c045ca9da07bf7c723a49b>:0 
09-19 11:45:51.602 I/MonoDroid(21421):   at Android.Views.View+IOnClickListenerImplementor.OnClick (Android.Views.View v) [0x00011] in <4a5b6a8d20fb4b61b369c90fc08d105e>:0 
09-19 11:45:51.602 I/MonoDroid(21421):   at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v) [0x0000f] in <4a5b6a8d20fb4b61b369c90fc08d105e>:0 
09-19 11:45:51.602 I/MonoDroid(21421):   at (wrapper dynamic-method) System.Object:dc465a37-6d47-4c6c-b2cb-a11eb23b5902 (intptr,intptr,intptr)
09-19 11:45:51.610 W/art     (21421): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
An unhandled exception occured.

Thus marking as CONFIRMED

On a sidenote, I did notice that when trying to debug these types, the debugger also crashes(Hover for value inspection):

09-19 11:52:13.398 F/libc    (22835): Fatal signal 7 (SIGBUS), code 1, fault addr 0xbeb93ffd in tid 22864 (Debugger agent)
Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.
   at Mono.Debugger.Soft.Connection.SendReceive(CommandSet command_set, Int32 command, PacketWriter packet)
   at Mono.Debugger.Soft.Connection.StackFrame_GetValues(Int64 thread_id, Int64 id, Int32[] pos)
   at Mono.Debugger.Soft.StackFrame.GetValue(LocalVariable var)
   at Mono.Debugging.Soft.VariableValueReference.get_Value()
   at Mono.Debugging.Evaluation.ValueReference.GetValue(EvaluationContext ctx)
   at Mono.Debugging.Evaluation.ValueReference.OnCreateObjectValue(EvaluationOptions options)
   at Mono.Debugging.Evaluation.ValueReference.CreateObjectValue(EvaluationOptions options)

## Version Information


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