Skip to content

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

Merged
rolfbjarne merged 7 commits into
dotnet:masterfrom
radical:add-drawing-common-reference-master
May 9, 2019
Merged

rolfbjarne merged 7 commits into
dotnet:masterfrom
radical:add-drawing-common-reference-master

Conversation

@radical

@radical radical commented May 8, 2019

Copy link
Copy Markdown
Member

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.
```

@rolfbjarne rolfbjarne left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

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
         dotnet#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

spouliot commented May 8, 2019

Copy link
Copy Markdown
Contributor

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 -->

rolfbjarne added 2 commits May 8, 2019 14:37
…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
Copy Markdown
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

radical commented May 8, 2019

Copy link
Copy Markdown
Member Author

@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

spouliot commented May 8, 2019

Copy link
Copy Markdown
Contributor

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

spouliot commented May 8, 2019

Copy link
Copy Markdown
Contributor

build

@monojenkins

Copy link
Copy Markdown
Contributor

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

spouliot commented May 9, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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).

<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="@(_IpaPackageFile)" />
</Target>

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

Copy link
Copy Markdown
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

<RemoveDir Directories="$(IntermediateOutputPath)" />
</Target>

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

Copy link
Copy Markdown
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
Copy Markdown
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
4 of 5 tasks
@monojenkins

Copy link
Copy Markdown
Contributor

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 dotnet:master May 9, 2019
@rolfbjarne

Copy link
Copy Markdown
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