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

Add UWP test runner #1358

Merged
merged 13 commits into from
May 3, 2017
Merged

Add UWP test runner #1358

merged 13 commits into from
May 3, 2017

Conversation

nirinchev
Copy link
Member

Description

Part of #1081

@nirinchev nirinchev added this to the uwp milestone Apr 18, 2017
@@ -449,6 +449,39 @@ internal override Expression VisitMethodCall(MethodCallExpression m)
throw new NotSupportedException($"The method '{m.Method.Name}' is not supported");
}

// Compares two methods for equality. .NET Native's == doesn't return expected results.
private static bool AreMethodsSame(MethodInfo first, MethodInfo second)
Copy link
Member Author

Choose a reason for hiding this comment

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

👀

Copy link
Member

Choose a reason for hiding this comment

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

Could we compare the MethodHandle property on MethodInfo directly?

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks like MethodHandle is not available in .NET Standard 1.4 😞

@@ -368,7 +368,7 @@ public override int GetHashCode()
{
ThrowIfDisposed();

return (int)SharedRealmHandle.DangerousGetHandle();
return (int)((long)SharedRealmHandle.DangerousGetHandle() % int.MaxValue);
Copy link
Member Author

Choose a reason for hiding this comment

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

👀

Copy link
Contributor

Choose a reason for hiding this comment

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

What's going on here?

Copy link
Member Author

@nirinchev nirinchev May 2, 2017

Choose a reason for hiding this comment

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

DangerousGetHandle() returns IntPtr which is long on 64 bit devices. I'm not sure how it has worked until now, but on UWP it consistently overflows. There are different strategies for wrapping it in an int - I chose one that seemed fine, but I'm open to suggestions if anyone has a better idea :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I'm seeing now that it's in GetHashCode. No worries then

[Values(0, 6, 30, 59)] int mins,
[Values(0, 6, 30, 59)] int secs,
[Values(0, 1, 999)] int ms)
[TestCaseSource(nameof(SetAndGetPropertyTestCases))]
Copy link
Member Author

Choose a reason for hiding this comment

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

.NET Native fails to correctly pass attributes with arrays

return GetByteArrayBuffer(propertyIndex, 0);
}

private unsafe byte[] GetByteArrayBuffer(IntPtr propertyIndex, int size)
Copy link
Member Author

Choose a reason for hiding this comment

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

👀

var path = Path.Combine(assemblyLocation, "lib", "win32", architecture) + Path.PathSeparator + Environment.GetEnvironmentVariable("PATH");
Environment.SetEnvironmentVariable("PATH", path);
}
catch (PlatformNotSupportedException)
Copy link
Member Author

Choose a reason for hiding this comment

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

I was unable to figure out a way to determine whether we're UWP or regular Windows Desktop app :/ The hack with checking for a Windows Runtime type doesn't work, as you can reference WindowsRuntime in a regular app. Suggestions are welcome.

Copy link
Member

Choose a reason for hiding this comment

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

Well, if it works with the try/catch let's leave it as it is.

@nirinchev nirinchev requested a review from fealebenpae April 24, 2017 22:31
@kristiandupont kristiandupont mentioned this pull request Apr 27, 2017
8 tasks
@nirinchev nirinchev force-pushed the ni/uwp-test-runner branch from 994bc1e to 725b8c2 Compare April 27, 2017 11:06
@nirinchev nirinchev changed the base branch from ni/android-test-runner to master April 27, 2017 11:08
@@ -368,7 +368,7 @@ public override int GetHashCode()
{
ThrowIfDisposed();

return (int)SharedRealmHandle.DangerousGetHandle();
return (int)((long)SharedRealmHandle.DangerousGetHandle() % int.MaxValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

What's going on here?

@nirinchev nirinchev force-pushed the ni/uwp-test-runner branch from 725b8c2 to 1cdef23 Compare May 3, 2017 13:55
@@ -80,4 +80,5 @@
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Fody.2.0.6\build\netstandard1.4\Fody.targets" />
<Import Project="..\..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('..\..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
Copy link
Member

Choose a reason for hiding this comment

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

Indentation.

@@ -449,6 +449,39 @@ internal override Expression VisitMethodCall(MethodCallExpression m)
throw new NotSupportedException($"The method '{m.Method.Name}' is not supported");
}

// Compares two methods for equality. .NET Native's == doesn't return expected results.
private static bool AreMethodsSame(MethodInfo first, MethodInfo second)
Copy link
Member

Choose a reason for hiding this comment

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

Could we compare the MethodHandle property on MethodInfo directly?

@nirinchev nirinchev merged commit 24f1ca3 into master May 3, 2017
@nirinchev nirinchev removed the S:Review label May 3, 2017
@nirinchev nirinchev deleted the ni/uwp-test-runner branch May 3, 2017 23:11
@nirinchev nirinchev restored the ni/uwp-test-runner branch May 8, 2017 11:13
@nirinchev nirinchev deleted the ni/uwp-test-runner branch May 8, 2017 11:15
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants