Bug 57433 - Error debugging in device
Summary: Error debugging in device
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.5
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2017-06-13 14:31 UTC by Carla Sampaio
Modified: 2017-06-28 18:16 UTC (History)
5 users (show)

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:

Description Carla Sampaio 2017-06-13 14:31:42 UTC
Hi, I m trying to debug my app in an android device, it always worked, but now it gives me this exception:

Method 'Xamarin.Forms.Device.set_OS' not found.

in this line:

global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

Can someone help me with this?


  at Xamarin.Forms.Forms.Init (Android.Content.Context activity, Android.OS.Bundle bundle) [0x00006] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Forms.cs:71 
  at RiopeleMobile.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00084] in /Users/carla.sampaio/Desktop/RiopeleMobile/Droid/MainActivity.cs:48 
  at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <7e083afc7c9045f59e01d9c14931060d>:0 
  at (wrapper dynamic-method) System.Object:0d323805-ca38-4833-b67e-8779f2274108 (intptr,intptr,intptr)
Comment 1 Paul DiPietro [MSFT] 2017-06-24 21:57:52 UTC
Can you reliably reproduce this? What happens if you try each of the following:

- Create a new project?
- Delete your bin/obj folders and clean/rebuild the project?

This is set to 2.3.5. Is this the latest prerelease you're using? This will just be set to needinfo until we get a bit more information (and potentially even a reproduction) back from you.
Comment 2 Carla Sampaio 2017-06-27 10:08:15 UTC
The file is in here: https://www.mediafire.com/?cbe6wu51aaob6qy

I already deleted the bin/obj folder and rebuild it, but nothing works.
Comment 3 Jimmy [MSFT] 2017-06-28 18:16:18 UTC
Hi Carla, thank you for providing that! I was able to reproduce the crash when I tried to run it on a device.

I saw that the projects have a Zxing directory that contain local versions of the Zxing and Xamarin.Forms assemblies. I looked at the project references in the Solution Explorer in VS and I noticed that some of the Xamarin.Forms references were pointing to those local assemblies instead of the ones in the package directory. If I changed them to point to the packages directory and rebuilt the project, the app launched successfully. It seems like there must be a version mismatch between the local and package assemblies that is leading to the crash.

I would recommended installing the Zxing and Xamarin.Forms packages through the NuGet package manager for both the PCL and Android projects if possible in order to avoid this issue. Otherwise you must ensure that all the Xamarin.Forms assemblies are from the same version by only referencing local copies and not also installing the NuGet package in either of the projects.

Hope this helps!