Bug 22043 - Error CS0246 The type or namespace name BaseWrapper could not be found. Are you missing an assembly reference?
Summary: Error CS0246 The type or namespace name BaseWrapper could not be found. Are y...
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.2.6
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-08-12 13:31 UTC by John Miller [MSFT]
Modified: 2017-01-09 22:24 UTC (History)
3 users (show)

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


Attachments
DLL (6.12 MB, application/octet-stream)
2014-08-13 19:15 UTC, John Miller [MSFT]
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 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:
Status:
RESOLVED NOT_ON_ROADMAP

Description John Miller [MSFT] 2014-08-12 13:31:27 UTC
**Overview:**

   The attached binding project always fails with an exception when building. 

**Steps to Reproduce:**

   1. Download the provided sample.
   2. Do a Rebuild on the project.

**Actual Results:**

   > Error CS0246: The type or namespace name `BaseWrapper' could not be found. Are you missing an assembly reference? (CS0246)

**Expected Results:**

   No error.

**Build Date & Platform:**

   XI 7.2.6

**Additional Information:**

   After a failed Rebuild, if you choose to simply Build the project it will succeed. However, the resulting DLL has no code in it.
Comment 2 Sebastien Pouliot 2014-08-12 17:13:31 UTC
BaseWrapper is a recent addition (to share more code across protocols implementations). Maybe it's missing a `using` clause ?!?

@Alex can you have a look at the sample ?
Comment 3 Alex Soto [MSFT] 2014-08-13 01:41:13 UTC
@John

Hello I've tried the attached sample and I can compile it just fine using X.I 7.2.6 here is my version information, can you spot something different in your system?

=== Xamarin Studio ===

Version 5.2.1 (build 1)
Installation UUID: 4b03e950-733c-4da6-8bee-bdca7529a49c
Runtime:
	Mono 3.6.0 ((no/f540f8a)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000039

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 7.2.6.28 (Business Edition)
Hash: 606f31a
Branch: 
Build date: 2014-08-01 15:27:48-0400
Comment 4 John Miller [MSFT] 2014-08-13 12:30:07 UTC
@Alex

I have the same installed, and I still get the error. Are you doing a Rebuild (Or clean/build)?

Also, check if the DLL being made actually has code in it.
Comment 5 Alex Soto [MSFT] 2014-08-13 15:07:13 UTC
@John

Yup I have done clean/Rebuild and also nuked bin and obj directories just to make sure. Dll has everything inside.

http://www.screencast.com/t/2LgcQ81t
Comment 6 John Miller [MSFT] 2014-08-13 17:00:51 UTC
@Alex,

Odd. Here is what I see doing _the same_: 

http://screencast.com/t/S7QBbvgI
Comment 7 Sebastien Pouliot 2014-08-13 17:12:01 UTC
@John please show us the generated code (that error occurs on line 153, gist the whole file) and the build output (it's not visible in your screencase). 

There must be a difference somewhere and that difference should point us to what's going on :-)
Comment 9 Sebastien Pouliot 2014-08-13 18:49:11 UTC
What's /reference:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll_backup.dll ?

Can you attach that file ?
Comment 10 John Miller [MSFT] 2014-08-13 19:15:24 UTC
Created attachment 7687 [details]
DLL
Comment 11 John Miller [MSFT] 2014-08-13 19:17:14 UTC
I am not sure where that file came from, but deleting it fixes my problem!
Comment 12 Sebastien Pouliot 2014-08-14 10:07:11 UTC
@John was that a bug for a customer ? or did it just happen to you ? (this looks like you applied a manual hotfix and kept a backup of the original monotouch.dll)

The problem is that monotouch.dll_backup.dll file is older than the 7.2.6 monotouch, i.e.

> 7.2.3.39; git-rev-head:fc6f56ba351c076834ad47a8b817ae3993c285e3; git-branch:(detached

and does not have the (new) BaseWrapper type that btouch-generated bindings requires. So it's kind of invalid, except that it expose two issues in the binding task -> Jeff 

---

@Jeff

a. Do you have any clue why the binding task would pick up a monotouch.dll_backup.dll file ? (when present) instead of monotouch.dll ? (try copying the attached assembly to your system to duplicate).

b. It seems (see screencasts) the rebuilding the bindings a second time results in in empty/invalid assembly.
Comment 13 John Miller [MSFT] 2014-08-14 13:43:57 UTC
@Sebastien,

It was on my machine, and you are correct. I applied a hotfix a few months ago and forgot about that file. I guess I will make my backup naming convention more cryptic. ;)

Thanks for looking at this!
Comment 14 Jeffrey Stedfast 2014-08-19 17:30:48 UTC
This is a bug in the compiler, I think. The BTouchTask passes the BaseLibDll directory path to btouch as the argument to "/lib:"

btouch then passes that directory to smcs as the directory search path for the assemblies.

smcs somehow decides to use monotouch.dll_backup.dll

I haven't tracked it any further.
Comment 15 Sebastien Pouliot 2017-01-09 22:24:02 UTC
Issue is not within XI