Skip to content

Commit

Permalink
[linker] Ignore [AssemblyMetadata] before net6 (#11944)
Browse files Browse the repository at this point in the history
This was allowed to ease existing (3rd party) code migration into net6.

However the reverse can also happen: trying to use net6 code with the
legacy SDK. In such case it's possible other (newer) attributes are being
used to preserve members.

ref: dotnet/aspnetcore#33269
  • Loading branch information
1 parent 0abe1f9 commit c4b89cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/Foundation/LinkerSafeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
using System;

namespace Foundation {


#if NET
[Obsolete ("Replace with '[assembly: System.Reflection.AssemblyMetadata (\"IsTrimmable\", \"True\")]'.")]
#endif
[AttributeUsage (AttributeTargets.Assembly)]
public sealed class LinkerSafeAttribute : Attribute {

Expand Down
9 changes: 2 additions & 7 deletions tools/common/Tuning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,8 @@ protected override bool IsLinkerSafeAttribute (CustomAttribute attribute)
case "LinkerSafeAttribute":
return true; // namespace is not important
case "AssemblyMetadataAttribute":
if (!attribute.HasConstructorArguments)
return false;
if (at.Namespace != "System.Reflection")
return false;
if (attribute.ConstructorArguments [0].Value as string != "IsTrimmable")
return false;
return (attribute.ConstructorArguments [1].Value.ToString ().ToLowerInvariant () == "true");
// this is only true for net6+ and can depends on other features not available on the legacy linker
return false;
}
return false;
}
Expand Down

8 comments on commit c4b89cd

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

Packages generated

View packages

Test results

4 tests failed, 214 tests passed.

Failed tests

  • introspection/Mac Catalyst/Debug: TimedOut (Execution timed out after 1200 seconds.
    No test log file was produced)
  • introspection/watchOS 32-bits - simulator/Debug (watchOS 5.0): Failed
  • monotouch-test/iOS Unified 32-bits - simulator/Debug: Failed
  • Generator tests/NUnit: Failed (Execution failed with exit code 1)

Pipeline on Agent XAMBOT-1036.BigSur
[linker] Ignore [AssemblyMetadata] before net6 (#11944)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🔥 Tests failed catastrophically on VSTS: device tests tvOS 🔥

Not enough free space in the host.

Pipeline on Agent
[linker] Ignore [AssemblyMetadata] before net6 (#11944)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[linker] Ignore [AssemblyMetadata] before net6 (#11944)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[linker] Ignore [AssemblyMetadata] before net6 (#11944)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

❌ Tests failed on macOS Mac Catalina (10.15) ❌

Tests failed on Mac Catalina (10.15).

Failed tests are:

  • introspection
  • xammac_tests

Pipeline on Agent
[linker] Ignore [AssemblyMetadata] before net6 (#11944)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

❌ Tests failed on macOS Mac Mojave (10.14) ❌

Tests failed on Mac Mojave (10.14).

Failed tests are:

  • introspection
  • xammac_tests

Pipeline on Agent
[linker] Ignore [AssemblyMetadata] before net6 (#11944)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

❌ Tests failed on macOS Mac High Sierra (10.13) ❌

Tests failed on Mac High Sierra (10.13).

Failed tests are:

  • introspection
  • xammac_tests

Pipeline on Agent
[linker] Ignore [AssemblyMetadata] before net6 (#11944)

@vs-mobiletools-engineering-service2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS32b). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[linker] Ignore [AssemblyMetadata] before net6 (#11944)

Please sign in to comment.