-
Notifications
You must be signed in to change notification settings - Fork 167
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
Add UWP test runner #1358
Conversation
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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))] |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
994bc1e
to
725b8c2
Compare
@@ -368,7 +368,7 @@ public override int GetHashCode() | |||
{ | |||
ThrowIfDisposed(); | |||
|
|||
return (int)SharedRealmHandle.DangerousGetHandle(); | |||
return (int)((long)SharedRealmHandle.DangerousGetHandle() % int.MaxValue); |
There was a problem hiding this comment.
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?
Closes #1349
725b8c2
to
1cdef23
Compare
Realm/Realm.Sync/Realm.Sync.csproj
Outdated
@@ -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')" /> |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
Description
Part of #1081