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

[linker] Use correct namespace for async debugging helpers. Fixes #59015 (#2782) #2788

Merged
merged 1 commit into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tests/linker-ios/link all/LinkAllTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
using System.Net;
using System.Net.Security;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Security.Cryptography.X509Certificates;

using MonoTouch;
Expand Down Expand Up @@ -542,5 +544,34 @@ public void WebKit_NSProxy ()
var fqn = typeof (NSObject).AssemblyQualifiedName.Replace ("Foundation.NSObject", "Foundation.NSProxy");
Assert.Null (Type.GetType (fqn), fqn);
}

[Test]
public void Bug59015 ()
{
CheckAsyncTaskMethodBuilder (typeof (AsyncTaskMethodBuilder));
CheckAsyncTaskMethodBuilder (typeof (AsyncTaskMethodBuilder<int>));
var t = typeof (Task);
var snfwc = t.GetMethod ("SetNotificationForWaitCompletion", BindingFlags.Instance | BindingFlags.NonPublic);
#if DEBUG
Assert.NotNull (snfwc, "Task.NotifyDebuggerOfWaitCompletion");
#else
// something keeps it from being removed
// Assert.Null (snfwc, "Task.NotifyDebuggerOfWaitCompletion");
#endif
}

void CheckAsyncTaskMethodBuilder (Type atmb)
{
Assert.NotNull (atmb, "AsyncTaskMethodBuilder");
var snfwc = atmb.GetMethod ("SetNotificationForWaitCompletion", BindingFlags.Instance | BindingFlags.NonPublic);
var oifd = atmb.GetProperty ("ObjectIdForDebugger", BindingFlags.Instance | BindingFlags.NonPublic);
#if DEBUG
Assert.NotNull (snfwc, atmb.FullName + ".SetNotificationForWaitCompletion");
Assert.NotNull (oifd, atmb.FullName + ".ObjectIdForDebugger");
#else
Assert.Null (snfwc, atmb.FullName + ".SetNotificationForWaitCompletion");
Assert.Null (oifd, atmb.FullName + ".ObjectIdForDebugger");
#endif
}
}
}
28 changes: 17 additions & 11 deletions tools/linker/MobileMarkStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,19 +259,25 @@ void MarkMetadata (IMetadataTokenProvider tp)
void ProcessCorlib (TypeDefinition type)
{
switch (type.Namespace) {
case "System.Runtime.CompilerServices.AsyncTaskMethodBuilder":
if (DebugBuild)
MarkNamedMethod (type, "SetNotificationForWaitCompletion");
break;
case "System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1":
if (DebugBuild)
MarkNamedMethod (type, "SetNotificationForWaitCompletion");
case "System.Runtime.CompilerServices":
switch (type.Name) {
case "AsyncTaskMethodBuilder":
case "AsyncTaskMethodBuilder`1":
if (DebugBuild) {
MarkNamedMethod (type, "SetNotificationForWaitCompletion");
MarkNamedMethod (type, "get_ObjectIdForDebugger");
}
break;
}
break;
case "System.Threading.Tasks.Task":
if (DebugBuild)
MarkNamedMethod (type, "NotifyDebuggerOfWaitCompletion");
case "System.Threading.Tasks":
switch (type.Name) {
case "Task":
if (DebugBuild)
MarkNamedMethod (type, "NotifyDebuggerOfWaitCompletion");
break;
}
break;

case "System.Security.Cryptography":
switch (type.Name) {
case "Aes":
Expand Down