Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[msbuild] Add reference to System.Drawing.Common.dll to XI projects. #6011

Merged

Conversation

radical
Copy link
Contributor

@radical radical commented May 8, 2019

Fixes mono/mono#13483 :

@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.

Fixes mono/mono#13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```
Copy link
Member

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this on iOS, tvOS and watchOS projects, and the fix worked.

I also tested on Xamarin.Mac projects, and the fix didn't work there, so I copied the fix to the corresponding Xamarin.Mac targets file, and that worked, so I pushed the change.

@radical is there any way to for customers to undo/ignore this fix locally (in their csproj) if it ends up causing problems for someone?

@monojenkins

This comment has been minimized.

@monojenkins
Copy link
Collaborator

Build failure
Build succeeded
API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

2 tests failed, 0 tests skipped, 99 tests passed.

Failed tests

  • MSBuild tests/iOS: Failed (Execution failed with exit code 2)
  • mmptest/macOS/NonSystem: Failed (Execution failed with exit code 1)

…s_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         xamarin#1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
@spouliot
Copy link
Contributor

spouliot commented May 8, 2019

I think we should remove our hacks so we'll have an earlier warning is it breaks.

git grep System.Drawing.Common tests/
tests/introspection/iOS/introspection-ios.csproj:    <Reference Include="System.Drawing.Common" /> <!-- FIXME: https://github.com/mono/mono/issues/13483 -->
tests/monotouch-test/monotouch-test.csproj:    <Reference Include="System.Drawing.Common" /> <!-- FIXME: https://github.com/mono/mono/issues/13483 -->
tests/xammac_tests/xammac_tests.csproj:    <Reference Include="System.Drawing.Common" /> <!-- FIXME: https://github.com/mono/mono/issues/13483 -->

…owReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.
@rolfbjarne
Copy link
Member

I think we should remove our hacks so we'll have an earlier warning is it breaks.

Good point, I've removed them.

@radical
Copy link
Contributor Author

radical commented May 8, 2019

@radical is there any way to for customers to undo/ignore this fix locally (in their csproj) if it ends up causing problems for someone?

@rolfbjarne Not as is, but this could be made conditional on some new property that the user can set to disable this behavior.

@spouliot
Copy link
Contributor

spouliot commented May 8, 2019

bot issues

Java NullPointerException in logThis likely indicates an error in the Jenkins slave processIndication 1
--
  | MicrosoftAzureStorage - Upload ErrorMicrosoftAzureStorage - Error occurred while uploading to AzureIndication 2

@spouliot
Copy link
Contributor

spouliot commented May 8, 2019

build

@monojenkins
Copy link
Collaborator

Build failure
Build succeeded
API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

6 tests failed, 0 tests skipped, 228 tests passed.

Failed tests

  • dont link/watchOS - simulator/Release: Crashed
  • [NUnit] Mono SystemXmlTests/watchOS - simulator/Debug: Crashed
  • [NUnit] Mono SystemDataTests/watchOS - simulator/Debug: Crashed
  • [xUnit] Mono SystemSecurityXunit/watchOS - simulator/Debug: Crashed
  • [xUnit] Mono SystemXmlXunit/watchOS - simulator/Debug: Crashed
  • mmptest/macOS/NonSystem: Failed (Execution failed with exit code 1)

@spouliot
Copy link
Contributor

spouliot commented May 9, 2019

6 tests failed, 0 tests skipped, 228 tests passed
5x watchOS failures due to HE0038 https://github.com/xamarin/maccore/issues/581
1x failure due to expired certificates https://github.com/xamarin/maccore/issues/1597

@rolfbjarne
Copy link
Member

this could be made conditional on some new property that the user can set to disable this behavior.

Ok, I've added a DisableAutomaticSystemDrawingCommonReference variable that can be set (if anyone has a better name I'm open to suggestions).

@@ -458,6 +458,13 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="@(_IpaPackageFile)" />
</Target>

<Target Name="_AddExtraReferences" BeforeTargets="ResolveAssemblyReferences" Condition="'$(DisableAutomaticSystemDrawingCommonReference)' == ''">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing than in the Mac common targets

@@ -186,6 +186,13 @@ Copyright (C) 2014 Xamarin. All rights reserved.
<RemoveDir Directories="$(IntermediateOutputPath)" />
</Target>

<Target Name="_AddExtraReferences" BeforeTargets="ResolveAssemblyReferences" Condition="'$(DisableAutomaticSystemDrawingCommonReference)' == ''">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think DisableAutomaticSystemDrawingCommonReference should have a generic name to match the target name like DisableExtraReferences or DisableAutomaticExtraReferences.

Besides that, since it's a boolean property it'd be better give it a default value if it's empty (set it to false) or check if it's != 'true', because if someone sets it to false for any reason the target will be skipped when it shouldn't.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emaf ok, I've changed it to use DisableExtraReferences and check for (not) true instead of empty string.

@spouliot spouliot mentioned this pull request May 9, 2019
5 tasks
@monojenkins
Copy link
Collaborator

Build success
Build succeeded
API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
Test run succeeded

@rolfbjarne rolfbjarne merged commit 3a7bdc0 into xamarin:master May 9, 2019
@rolfbjarne
Copy link
Member

@monojenkins backport d16-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding System.Drawing.Common.dll reference for XI/XA projects
7 participants