Bug 29197 - WebView causes System.NullReferenceException
Summary: WebView causes System.NullReferenceException
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger ()
Version: 5.1
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-17 10:54 UTC by Dan Harris
Modified: 2015-07-03 10:16 UTC (History)
3 users (show)

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


Attachments
WebView null exception (32.63 KB, application/zip)
2015-05-12 14:48 UTC, Dan Harris
Details


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 for Bug 29197 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Dan Harris 2015-04-17 10:54:52 UTC
The attached file, WebViewCrash.zip, is the simple hello world app with a second activity with a WebView added.

Put a break point on line 21 of SecondActivity. When the app runs, tap the hello world click me button and the null exception happens at the break point.

In our production app, the EULA page contains the WebView. When the users move to the login page, the first attempt to login fails and sometimes the app crashes but not every time. The second attempt to login succeeds.

Thanks!
Dan
drharris@xactware.com
Comment 1 John Miller [MSFT] 2015-05-12 11:24:46 UTC
@Dan,

Looks like the project is missing. Could you re-upload?
Comment 2 Dan Harris 2015-05-12 14:48:42 UTC
Created attachment 11172 [details]
WebView null exception
Comment 3 John Miller [MSFT] 2015-05-12 14:57:58 UTC
New per comment #2
Comment 4 John Miller [MSFT] 2015-05-13 09:37:38 UTC
** Steps to Reproduce **

1. Run the attached sample project on an Android Device
2. Place a breakpoint on line 21 of SecondActivity.cs
3. Press the Hello World button

** Actual Results **

App crashes when there is a breakpoint

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object
[MonoDroid] at WebViewCrash.SecondActivity.OnCreate (Android.OS.Bundle) [0x00001] in /Users/johnmiller/Downloads/WebViewCrash/WebViewCrash/SecondActivity.cs:21
[MonoDroid] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d23da369/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.App.Activity.cs:2212
[MonoDroid] at (wrapper dynamic-method) object.0aab84a5-ed8c-44dc-b59d-6e848a3c4522 (intptr,intptr,intptr) <IL 0x00017, 0x00053>
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: WebViewCrash.WebViewCrash, PID: 24601
[AndroidRuntime] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[AndroidRuntime] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
[AndroidRuntime] Caused by: java.lang.reflect.InvocationTargetException
[AndroidRuntime] 	at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] 	at java.lang.reflect.Method.invoke(Method.java:372)
[AndroidRuntime] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
[AndroidRuntime] 	... 1 more
[AndroidRuntime] Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
[AndroidRuntime] at WebViewCrash.SecondActivity.OnCreate (Android.OS.Bundle) [0x00001] in /Users/johnmiller/Downloads/WebViewCrash/WebViewCrash/SecondActivity.cs:21
[AndroidRuntime] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d23da369/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.App.Activity.cs:2212
[AndroidRuntime] at (wrapper dynamic-method) object.0aab84a5-ed8c-44dc-b59d-6e848a3c4522 (intptr,intptr,intptr) <IL 0x00017, 0x00053>
[AndroidRuntime] 
[AndroidRuntime] 	at md5fec8e5000213c0337672ca6516d3450b.SecondActivity.n_onCreate(Native Method)
[AndroidRuntime] 	at md5fec8e5000213c0337672ca6516d3450b.SecondActivity.onCreate(SecondActivity.java:28)
[AndroidRuntime] 	at android.app.Activity.performCreate(Activity.java:5933)
[AndroidRuntime] 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
[AndroidRuntime] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
[AndroidRuntime] 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
[AndroidRuntime] 	at android.app.ActivityThread.access$800(ActivityThread.java:144)
[AndroidRuntime] 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
[AndroidRuntime] 	at android.os.Handler.dispatchMessage(Handler.java:102)
[AndroidRuntime] 	at android.os.Looper.loop(Looper.java:135)
[AndroidRuntime] 	at android.app.ActivityThread.main(ActivityThread.java:5221)
[AndroidRuntime] 	... 4 more

** Version Info **

=== Xamarin Studio ===

Version 5.9 (build 431)
Installation UUID: e01c3049-a2d2-4e0a-aad8-afe6fb627c4d
Runtime:
	Mono 4.0.0 ((detached/d136b79)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000143

=== Xamarin.Android ===

Version: 5.1.0.115 (Business Edition)
Android SDK: /Users/johnmiller/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.Mac ===

Version: 2.0.0.262 (Business Edition)

=== Xamarin.iOS ===

Version: 8.10.0.267 (Business Edition)
Hash: 6481535
Branch: master
Build date: 2015-04-27 04:38:13-0400

=== Build Information ===

Release ID: 509000431
Git revision: 7560726734fc7267de2fa9abed2509968deefaa8
Build date: 2015-04-17 19:25:48-04
Xamarin addins: 2e772c734ab3148054eae7bf8949f340fdeb5e5e

=== Operating System ===

Mac OS X 10.10.2


** Additional Info **

Remove the breakpoint on line 21 and repeat the test and it won't crash as expected.
Comment 5 Dan Harris 2015-05-27 12:23:35 UTC
Any progress made on this? We'd at least like to know what the problem is so we can come up with a solution and release our app.
Comment 6 Dan Harris 2015-06-05 16:06:07 UTC
We need to release on June 12th so we changed our WebView to a TextView and used Spannable to display the html file.

Still be cool to know what's up with WebView.