Bug 21658 - Android.Views.View does not contain a definition for GenerateViewId()
Summary: Android.Views.View does not contain a definition for GenerateViewId()
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: 4.12.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2014-07-29 10:15 UTC by F Masolijn
Modified: 2014-08-04 04:11 UTC (History)
4 users (show)

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

Screenshot showing the error (44.81 KB, image/png)
2014-07-29 10:16 UTC, F Masolijn

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 F Masolijn 2014-07-29 10:15:26 UTC
Not sure how this occurred, but I have a project in which the method GenerateViewId is no longer a part of the View class.

I've created a new project and that project seems to have no problems. So the problem isn't with the Visual Studio and/or Xamarin install.

At first I thought I had accidentally hidden Android.Views.View with another View class. But I don't have classes named 'View' in my project. Either way I checked this by addressing the global namespace, which does find the 'View' class. But it doesn't find the static GenerateViewId method.

At the moment I don't have a way to reproduce this problem, and frankly I'm rather stuck on what could cause this kind of problem. Recreating the entire project until the problem occurs again is simply impossible because of the size.
Comment 1 F Masolijn 2014-07-29 10:16:04 UTC
Created attachment 7513 [details]
Screenshot showing the error
Comment 2 F Masolijn 2014-07-29 10:26:17 UTC
Opened the same solution in Xamarin Studio and the problem remains the same.

In other words, it's either a bug in Xamarin.Android or in the state the solution.
Comment 3 Parmendra Kumar 2014-07-30 08:26:44 UTC
I have checked this issue and observed that GenerateViewId(); is not found and  the Exception shows generateViewId(); method.
steps for reproduce this issue

1. Create a Android WebView app
2. Write this line "global::Android.Views.View.GenerateViewId();" into OnCreate Method
3. Build successfully
4. Run This app and it show a exception that GenerateView(); method not found
5. Right click on GenerateViewId(); and go to definition.
6. observed that the definition of GenerateViewId(); is exist.
7. VS and XS both have same issue.

Screencast: http://screencast.com/t/IXITDXIC7b

=== Xamarin Studio ===

Version 5.1.4 (build 0)
Installation UUID: 917f9508-3cad-494a-8fd9-cc9e3683ecc5
	Microsoft .NET 4.0.30319.34014
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.25

=== Xamarin.Android ===

Version: 4.12.6 (Business Edition)
Android SDK: D:\SDKndk\AndroidSDK\android-sdk
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: C:\Program Files\Java\jdk1.6.0_31
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode)

=== Build Information ===

Release ID: 501040000
Git revision: 7d45bbe2ee22625f125d0c52548524f02d005cca
Build date: 2014-07-14 13:38:46-04
Xamarin addins: c78f1d88e57baa928aeee1484d96e6f8edf8de33

=== Operating System ===

Windows 6.2.9200.0
Comment 4 Jonathan Pryor 2014-08-02 09:23:43 UTC
What is the $(TargetFrameworkVersion) for your project? View.GenerateViewId() was added in API-17 (Android v4.2), so your project's $(TargetFrameworkVersion) must be v4.2 or higher to use.

Comment 5 F Masolijn 2014-08-04 04:11:31 UTC
It appears I should've checked TargetFrameworkVersion because I though I was targetting targeting API-17 while in reality I was targetting API-15. Also, it didn't occur to me that something as basic as generating a unique id would not be in anything but recent Android versions. Anyway, my apologies.