Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Re-enable UAP builds #27531

Merged
merged 12 commits into from
Mar 2, 2018
Merged

Re-enable UAP builds #27531

merged 12 commits into from
Mar 2, 2018

Conversation

nattress
Copy link
Contributor

@nattress nattress commented Feb 28, 2018

  • Revert the three commits that initially disabled the build
  • Add a uapaot flavor for System.Numerics.Vectors. It can no longer use the uap flavor since it depends directly on System.Private.CoreLib (whose strong name key is different for uap and uapaot).
  • Fix a series of UAP build breaks that have crept in over the last couple weeks

Fixes https://github.com/dotnet/corefx/issues/26802

@nattress
Copy link
Contributor Author

@jkotas PTAL at 80b0751
@stephentoub PTAL at 30d10f5
@JeffCyr / @stephentoub PTAL at f3a86db

If any of you can sanity check the other commits that would be great, too. Thanks!

@jkotas
Copy link
Member

jkotas commented Feb 28, 2018

If we re-enable this, what is our plan going to be with getting .NET Core API changes through? cc @joshfree

{
internal static partial class NameResolutionPal
{

Copy link
Member

Choose a reason for hiding this comment

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

Nit: extra lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

return false;

// We can't just check that 'GetAddrInfoEx' exists, because it existed before supporting overlapped.
// The existance of 'GetAddrInfoExCancel' indicates that overlapped is supported.
Copy link
Member

Choose a reason for hiding this comment

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

nit: typo existance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

{
internal static partial class NameResolutionPal
{

Copy link
Member

Choose a reason for hiding this comment

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

nit: extra line

/// Adds the extended path prefix (\\?\) if not already a device path, IF the path is not relative,
/// AND the path is more than 259 characters. (> MAX_PATH + null)
/// </summary>
internal static string EnsureExtendedPrefixOverMaxPath(string path)
Copy link
Member

Choose a reason for hiding this comment

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

cc @JeremyKuhne, PTAL

/// Adds the extended path prefix (\\?\) if not already a device path, IF the path is not relative,
/// AND the path is more than 259 characters. (> MAX_PATH + null)
/// </summary>
internal static string EnsureExtendedPrefixOverMaxPath(string path)
Copy link
Member

Choose a reason for hiding this comment

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

What API did this get added for? I specifically updated to do this below to put the prefix on with trailing spaces & periods to fix handling those paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

C:\git\corefx\src\Common\src\Interop\Windows\kernel32\Interop.CreateFile2.cs(95,39): error CS0117: 'PathInternal' does not contain a definition for 'EnsureExtendedPrefixOverMaxPath' [C:\git\corefx\src\System.IO.FileSystem.Watcher\src\System.IO.FileSystem.Watcher.csproj]

Copy link
Member

Choose a reason for hiding this comment

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

Thanks- please change that to the method below and remove this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JeremyKuhne Ok, so to confirm, I'll replace the call to EnsureExtendedPrefixOverMaxPath in Interop.CreateFile2.cs with a call to EnsureExtendedPrefixIfNeeded ?

Copy link
Member

@JeremyKuhne JeremyKuhne left a comment

Choose a reason for hiding this comment

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

Need to know what the EnsureExtendedPrefixOverMaxPath got added for to make sure we're not regressing a fix.

@@ -54,6 +54,8 @@
</ItemGroup>
<ItemGroup Condition=" '$(TargetsWindows)' == 'true'">
<Compile Include="System\Net\NameResolutionPal.Windows.cs" />
<Compile Include="System\Net\NameResolutionPal.Windows.NetCoreApp.cs" Condition="'$(TargetGroup)' != 'uap'"/>
Copy link
Member

Choose a reason for hiding this comment

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

We typically use Win32.cs suffix for these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So .Win32.cs and .Uap.cs suffixes then?

Copy link
Member

Choose a reason for hiding this comment

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

I think so. Here is example of prior art:

ProcessStartInfo.Uap.cs
ProcessStartInfo.Unix.cs
ProcessStartInfo.Win32.cs
ProcessStartInfo.Windows.cs

@@ -132,7 +134,7 @@
<Compile Include="$(CommonPath)\Interop\Windows\Kernel32\Interop.GetProcAddress.cs">
Copy link
Member

Choose a reason for hiding this comment

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

Exclude this one for Uap as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -54,6 +54,8 @@
</ItemGroup>
<ItemGroup Condition=" '$(TargetsWindows)' == 'true'">
<Compile Include="System\Net\NameResolutionPal.Windows.cs" />
<Compile Include="System\Net\NameResolutionPal.Windows.Win32.cs" Condition="'$(TargetGroup)' != 'uap'"/>
Copy link
Member

@jkotas jkotas Mar 1, 2018

Choose a reason for hiding this comment

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

Nit: There is no file with Windows.Win32.cs suffix today. Everything is using just .Win32.cs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -0,0 +1,96 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
Copy link
Member

Choose a reason for hiding this comment

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

Can we just add this to API compat baseline instead of adding the whole implementation back?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This failure is in GenFacades, not APICompat. So I believe not?

Copy link
Member

Choose a reason for hiding this comment

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

<GenFacadesIgnoreMissingTypes Condition="'$(TargetGroup)'=='uapaot'">true</GenFacadesIgnoreMissingTypes>

Used in number of places already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perfect - thanks!

@@ -23,7 +23,11 @@ public static partial class ThreadPool
public static void GetMinThreads(out int workerThreads, out int completionPortThreads) { throw null; }
public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack) { throw null; }
public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack, object state) { throw null; }
#if uap
Copy link
Member

Choose a reason for hiding this comment

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

Just add it to the API compat baseline instead of adding ifdefs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep that worked great.

@@ -10,6 +10,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Net.Http.cs" />
<Compile Include="System.Net.Http.Win32.cs" Condition="'$(TargetGroup)' != 'uap'" />
Copy link
Member

Choose a reason for hiding this comment

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

This is not Win32.cs specific. It is for both Windows and Unix. I think the original name would be fine. Or ifdef in the ref file would be fine too, I think. We have multiple other places with itdefs in ref files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll switch this to be #if uap

@@ -214,6 +215,7 @@
</PropertyGroup>
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
<Compile Include="System\Net\Http\HttpClientHandler.Core.cs" />
<Compile Include="System\Net\Http\HttpClientHandler.Win32.cs" />
Copy link
Member

Choose a reason for hiding this comment

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

It looks weird to be including Win32.cs file for Unix...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I'm going to just go with .NetCoreApp.cs for this. We already have .Unix, .Windows, .Core.

Copy link
Member

Choose a reason for hiding this comment

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

Nit: It should be all lowercase netcoreapp.cs to match the convention

{
internal static partial class NameResolutionPal
{
private static bool GetAddrInfoExSupportsOverlapped() => false;
Copy link

Choose a reason for hiding this comment

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

GetAddrInfoEx and GetAddrInfoExCancel are available in UAP no? LoadLibraryEx was used to test for unsupported windows version, but this may not be needed for UAP and it could return true.

https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think you're right. Once I get this checked in I'll verify and flip to true.

@danmoseley
Copy link
Member

Do you plan to do a private Helix run to look at test failures? We were nearly clean on CLR based UWP runs. ProjectN ones had a bunch of brokenness, but it might be worth checking how much it got worse while we were dark.

@nattress
Copy link
Contributor Author

nattress commented Mar 1, 2018

Yes, Jose is helping me get one kicked off so we can see what state UAP tests are in. Once the CI is green I hope to merge this since branch churn is busting this a couple times a day this week.

@@ -129,10 +131,10 @@
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs">
Copy link
Member

Choose a reason for hiding this comment

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

Should this be under Condition="'$(TargetGroup)' != 'uap'" as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that doesn't break the build.

<Link>Common\System\Net\ByteOrder.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
<Compile Include="..\..\src\System\Net\NameResolutionPal.Windows.cs">
<Link>ProductionCode\System\Net\NameResolutionPal.Windows.cs</Link>
</Compile>
<Compile Include="..\..\src\System\Net\NameResolutionPal.Windows.Uap.cs" Condition="'$(TargetGroup)' == 'uap'">
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think this should be just NameResolutionPal.Uap.cs to follow the convention

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

With `Vector<T>` now residing in System.Private.CoreLib, directly reference System.Private.Corelib instead of contracts just like netcoreapp does.

Add uapaot flavor since System.Private.CoreLib has a different strong name key on that platform.
Add the helper method `System.IO.PathInternal.EnsureExtendedPrefixOverMaxPath` to Common\src\System\IO\PathInternal.Windows.cs. It was previously not visible to UAP since  Common\src\CoreLib\System\IO\PathInternal.Windows.cs is not included in UAP compilation.
SocketsHttpHandler is not supported in uap and is currently leaking into UAP builds since they've been disabled for a few weeks. Adjust the contract so it's not available to UAP, and clean the implementation assembly so SocketsHttpHandler internals don't leak out into HttpClientHandler.Core.cs.
`System.Net.NameResolutionPal.GetAddrInfoExSupportsOverlapped` uses LoadLibraryExW which is not compatible with UAP (which only supports LoadLibrary of DLLs within a container). Refactor the helper so UAP returns false.
- Refactor to remove code duplication in HttpClientHandler.Win32.cs
- Suffix non-UAP source files with.Win32.cs instead of NetCoreApp.cs to follow branch convention
- Fix spacing
- Baseline the ApiCompat and GenFacades failures in System.Runtime.Extensions and System.Threading.ThreadPool.
- Adjust naming of files to match branch conventions
Fix up some configuration issues with uap packaging. The CoreFX.Private.TestUtilities packaging needs updated build tools which can map between uwp6.0 and netstandard2.0.

#ifdef out Thread.GetCurrentProcessorId until we get a new System.Private.CoreLib.
- Fix a couple Nits
- Fix recent commit breaking UAP
@nattress nattress merged commit c9cdfba into dotnet:master Mar 2, 2018
@stephentoub
Copy link
Member

I have a change that was already checked into coreclr that alters some core methods. Does this change mean we now need to wait for a new net native build with those changes before we can update corefx? coreclr and corefx will be inconsistent until that's merged.

@nattress
Copy link
Contributor Author

nattress commented Mar 2, 2018

Changes to System.Private.CoreLib? You should be able to baseline / if-def around them (or just disable building the assembly for UAP if it's not easily scoped out) until the same change flows in from net native.

@stephentoub
Copy link
Member

Changes to System.Private.CoreLib?

Yes, in particular to a signature of a virtual method on Stream.

@jkotas
Copy link
Member

jkotas commented Mar 2, 2018

This change would be really ugly to ifdef. My recommendation would be to disable building of as many projects as necessary to get your change through.

@@ -27,8 +27,8 @@ def configurations = [
['TGroup':"netcoreapp", 'Pipeline':osxPipeline, 'Name':'OSX', 'ForPR':"Debug-x64", 'Arch':['x64']],
['TGroup':"netcoreapp", 'Pipeline':winPipeline, 'Name':'Windows' , 'ForPR':"Debug-x64|Release-x86"],
['TGroup':"netfx", 'Pipeline':winPipeline, 'Name':'NETFX', 'ForPR':"Release-x86"],
// ['TGroup':"uap", 'Pipeline':winPipeline, 'Name':'UWP CoreCLR', 'ForPR':"Debug-x64"],
// ['TGroup':"uapaot", 'Pipeline':winPipeline, 'Name':'UWP NETNative', 'ForPR':"Release-x86"],
['TGroup':"uap", 'Pipeline':winPipeline, 'Name':'UWP CoreCLR', 'ForPR':"Debug-x64"],
Copy link
Member

Choose a reason for hiding this comment

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

We might want to consider not running tests on this leg either, since we know a few will be broken. If we don't do that, we'll have to basically ignore this leg if it fails on a PR.

Copy link
Member

Choose a reason for hiding this comment

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

Right, that's what I have done in #27640

@@ -6,7 +6,7 @@
<ShouldWriteSigningRequired>false</ShouldWriteSigningRequired>
<AllowReferenceFromRuntime>true</AllowReferenceFromRuntime>
<RuntimeProjectFile>$(ProjectDir)\external\test-runtime\XUnit.Runtime.depproj</RuntimeProjectFile>
<PackageTargetFramework>netstandard2.0</PackageTargetFramework>
<PackageTargetFramework>netstandard2.0;$(UAPvNextTFM)</PackageTargetFramework>
Copy link
Member

Choose a reason for hiding this comment

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

This should get undone before merging to release/2.1 since they are already using the new nuget mappings. I will try to fix this before the merge.

@@ -9,6 +9,7 @@
<BuildConfigurations>
netcoreapp;
uap;
uapaot;
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong, why do we want a new configuration if uap and uapaot produce the exact same dll?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you are right.

Copy link
Member

Choose a reason for hiding this comment

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

Deleted in #27663

@@ -7,7 +7,7 @@
<DocumentationFile>$(OutputPath)$(MSBuildProjectName).xml</DocumentationFile>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsTargetingNetFx Condition="'$(TargetGroup)'=='netfx' OR '$(TargetGroup)'=='net46'">true</IsTargetingNetFx>
<IsTargetingNetCoreApp Condition="'$(TargetGroup)'=='netcoreapp'">true</IsTargetingNetCoreApp>
<IsTargetingNetCoreApp Condition="'$(TargetGroup)'=='netcoreapp' OR '$(TargetGroup)'=='uap' OR '$(TargetGroup)'=='uapaot'">true</IsTargetingNetCoreApp>
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right. We probably need to change property name.

Copy link
Member

Choose a reason for hiding this comment

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

We use netcoreapp to netcoreapp+uap+uapaot in many places. Yes, it is confusing, but one more place does not really make a difference.

@@ -7,6 +7,7 @@
net46;
</PackageConfigurations>
<BuildConfigurations>
uapaot-Windows_NT;
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong I believe, we don't need a uapaot config since the uap config seems to be equivalent.

Copy link
Member

Choose a reason for hiding this comment

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

It is not equivalent.

@karelz karelz added this to the 2.1.0 milestone Mar 10, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* Build uapaot System.Numerics.Vectors

With `Vector<T>` now residing in System.Private.CoreLib, directly reference System.Private.Corelib instead of contracts just like netcoreapp does.

Add uapaot flavor since System.Private.CoreLib has a different strong name key on that platform.

* Make EnsureExtendedPrefixOverMaxPath available to UAP

Add the helper method `System.IO.PathInternal.EnsureExtendedPrefixOverMaxPath` to Common\src\System\IO\PathInternal.Windows.cs. It was previously not visible to UAP since  Common\src\CoreLib\System\IO\PathInternal.Windows.cs is not included in UAP compilation.

* Keep SocketsHttpHandler out of UAP builds

SocketsHttpHandler is not supported in uap and is currently leaking into UAP builds since they've been disabled for a few weeks. Adjust the contract so it's not available to UAP, and clean the implementation assembly so SocketsHttpHandler internals don't leak out into HttpClientHandler.Core.cs.

* Fix GetAddrInfoExSupportsOverlapped UAP build break

`System.Net.NameResolutionPal.GetAddrInfoExSupportsOverlapped` uses LoadLibraryExW which is not compatible with UAP (which only supports LoadLibrary of DLLs within a container). Refactor the helper so UAP returns false.

* Revert "Disable UAP legs per dotnet/corefx#26802 (dotnet/corefx#26822)"

This reverts commit dotnet/corefx@120dce4.

* Revert "Disable UAP configurations in all configurations build"

This reverts commit dotnet/corefx@2202b4f.

* Revert "Disable UAP official builds (dotnet/corefx#26871)"

This reverts commit dotnet/corefx@ef79caf.

- Baseline the ApiCompat and GenFacades failures in System.Runtime.Extensions and System.Threading.ThreadPool.
- Adjust naming of files to match branch conventions
- Fix up some configuration issues with uap packaging. The CoreFX.Private.TestUtilities packaging needs updated build tools which can map between uwp6.0 and netstandard2.0.
- ifdef out Thread.GetCurrentProcessorId until we get a new System.Private.CoreLib.


Commit migrated from dotnet/corefx@c9cdfba
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants