Bug 3525 - mcw-gen improperly resolves types from referenced assemblies.
Summary: mcw-gen improperly resolves types from referenced assemblies.
Alias: None
Product: Android
Classification: Xamarin
Component: Tools and Addins ()
Version: 4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2012-02-17 17:18 UTC by Jonathan Pryor
Modified: 2012-04-23 04:30 UTC (History)
1 user (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 Jonathan Pryor 2012-02-17 17:18:02 UTC
THe problem is seen when trying to bind the redlaser SDK:

1. Go to http://www.redlaser.com/developers/ and download the Android SDK evaluation library.

2. Unzip the installer:

> unzip RedLaser_AndroidSDK_2.1.0.zip
> cd RLSample/libs

3. Bind it:

> /Developer/MonoAndroid/usr/bin/mcw-gen --jar=redlasersdk.jar -sdk-platform=8 --sdk-dir=/opt/android/sdk --dll:RedLaser.dll

Expected output: a valid assembly.

Actual output:
obj/src/generated/Com.Google.Zxing.Oned.Rss.Expanded.Decoders.AbstractExpandedDecoder.cs(14,71): error CS0234: The type or namespace name `GeneralAppIdDecoder' does not exist in the namespace `Com.Google.Zxing.Oned.Rss.Expanded.Decoders'. Are you missing an assembly reference?

Not sure what's up with that, so ignore it for now.

The reason for opening this bug is that obj/src/generated/Com.Ebay.Redlasersdk.Scanner.BarcodeScanActivity.cs has invalid C#:

	static IntPtr id_clearWallpaper;
	[Register ("clearWallpaper", "()V", "GetClearWallpaperHandler")]
	public override System.Void ClearWallpaper ()

System.Void isn't a valid return type. :-)

Another oddity is that this is in the type BarcodeScanActivityInvoker, and is overriding Context.ClearWallpaper(). Why is it overriding ClearWallpaper()? clearWallpaper() isn't declared within generated-api.xml, so we seem to be overzealous in generating method overrides for the invoker here. :-(
Comment 1 Atsushi Eno 2012-02-20 03:33:45 UTC
I can't see the problem.

- Is it about clearWallpaper() method? As long as I see the jar in Eclipse, this method does not seem to exist in that class as a public method. It makes me feel odd, but that's not what about your report.
- Or do you mean System.Void cannot be used as a type? I don't see any complaints on compiling "class Test { public static System.Void Main() {} }" code with mcs.

For ClearWallpaper() being overriden, I have no idea. It is abstract and any non-abstract derivation of Context class must override it, but ContextWrapper should have implemented it.
Comment 2 Atsushi Eno 2012-02-21 01:38:35 UTC
The latest generator should generate binding (not sure if it *works*; to verify that someone has to write sample code), with some required metadata fixup (which I believe is valid, excludes non-public and method with non-supported numbers of arguments).

I wonder if we should keep the issue open (not sure if excessive ClearWallpaper() is a bug that needs fix or just an internal wishlist).
Comment 3 Atsushi Eno 2012-04-23 04:30:58 UTC
This System.Void issue should have been already fixed (Mar 15th).