xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.49k stars 515 forks source link

System bmac invocations now require all assemblies to be explicitly passed in #3948

Closed chamons closed 6 years ago

chamons commented 6 years ago

Steps to Reproduce

Try compiling an empty foo.cs referencing System.Drawing.dll from

/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/bmac  --tmpdir=tmp/ --baselib=/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/x86_64/full/Xamarin.Mac.dll -r=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api/System.Drawing.dll -native-exception-marshalling foo.cs --new-style

vs

/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/bmac  --tmpdir=tmp/ --baselib=/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/x86_64/full/Xamarin.Mac.dll -r=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api/System.Drawing.dll -native-exception-marshalling foo.cs --new-style -r=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api/System.dll -r=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api/mscorlib.dll 

Expected Behavior

Before (likely before https://github.com/xamarin/xamarin-macios/commit/1d72f45dfd4f0fff2159762a32e87bc7913dacf7) you could compile without ref'ing all of the assemblies yourself.

Actual Behavior

You'll get a number of compile errors.

This code: https://github.com/xamarin/xamarin-macios/blob/master/src/btouch.cs#L381

may be wrong and assuming Modern/Full and ignoring System. In general the XM code needs to be scanned for such errors, and preferably tests written.

Environment

Lastest master XM

VS bug #612783

alanmcgovern commented 6 years ago

The original invocation was -r=System.Drawing, the new invocation is -r=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api/System.Drawing.dll, and also explicitly referencing all the other dependencies by full path too.

Referencing all the dependencies manually sounds ok, but hardcoding the full path to mono is annoying/problematic. It'd be better if I could just write:

-r:System.Drawing -r:System -r:System.Linq -r:System.Core

chamons commented 6 years ago

There is code https://github.com/xamarin/xamarin-macios/blob/master/src/btouch.cs#L609 that should be doing this but somehow isn't in this use case.

spouliot commented 6 years ago

@chamons is csc invoked with -lib:{path to mono assemblies} ?

chamons commented 6 years ago

Code inspection suggests it should. I'll need to dig into this, write tests, etc. The many varied paths are too hard to trace in my head with confidence.

spouliot commented 6 years ago

write tests

you're making it hard to disagree ;-)

alanmcgovern commented 6 years ago

The merged commit is still broken afaict:

2018-05-03T09:45:38.7095460Z   EXEC : error CS0006: Metadata file `System.Drawing' could not be found [/Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.iOS/external/ios-sim-sharp/MonoTouch.Hosting/MonoTouch.Hosting.csproj]

Was this supposed to make things 'just work' like they used to, or is this supposed to be a breaking change in bmac which we need to adjust for?

alanmcgovern commented 6 years ago

PR where we bumped to the new xammac: https://github.com/xamarin/designer/pull/854

spouliot commented 6 years ago

@alanmcgovern were you able to bump with that fix ?

alanmcgovern commented 6 years ago

https://github.com/xamarin/designer/pull/858

LGTM!

Thanks everyone!