xamarin-macios/tools/dotnet-linker
Rolf Bjarne Kvinge 25fc6c84d1
[dotnet-linker] Handle null fields in BackingFieldDelayHandler as unmarked fields. Fixes #16957. (#16970)
The BackingFieldDelayHandler will temporarily remove the body of Dispose
methods, and then for every field accessed in the Dispose method that was
preserved by the linker, we'll keep the corresponding code in the Dispose
method (otherwise we'd remove the code).

This is a way to remove fields that are _only_ accessed (and nulled out) in
the Dispose method.

However, we were running into a problem with determining if a field was marked
by the linker: if the field is in a generic type, and that field was not
marked by the linker, the linker might have actually removed the field from
the containing type before we're processing the Dispose methods, and we'd find
a null field definition where no null field definition was expected
(eventually resulting in an ArgumentNullException).

Fix this by treating a null field definition as an unmarked field.

Also add a test.

Fixes https://github.com/xamarin/xamarin-macios/issues/16957.
2022-12-07 15:53:15 +01:00
..
Steps [dotnet-linker] Only enable ForceLoad for native binding libraries if that's actually requested in the binding library. Fixes #16861. (#16879) 2022-11-29 09:28:57 +01:00
.gitignore Make our local .NET the default .NET for the build. (#15086) 2022-06-07 10:11:02 +02:00
ApplyPreserveAttributeBase.cs [autoformat] Add dotnet-linker to the projects to autoformat. (#16178) 2022-09-30 09:32:42 +02:00
BackingFieldDelayHandler.cs [dotnet-linker] Handle null fields in BackingFieldDelayHandler as unmarked fields. Fixes #16957. (#16970) 2022-12-07 15:53:15 +01:00
Compat.cs [dotnet] Honor 'TrimMode' to specify linker behavior if LinkMode/MtouchLink aren't set. Fixes #13518. (#13543) 2021-12-15 09:27:00 +01:00
DotNetResolver.cs [dotnet-linker] Give a better exception message when unable to resolve an assembly reference. (#16750) 2022-11-15 17:43:28 +01:00
Extensions.cs [autoformat] Add dotnet-linker to the projects to autoformat. (#16178) 2022-09-30 09:32:42 +02:00
LinkerConfiguration.cs [autoformat] Add dotnet-linker to the projects to autoformat. (#16178) 2022-09-30 09:32:42 +02:00
Makefile [net7.0] bump linker to net7.0 2022-08-05 18:03:40 -04:00
MarkIProtocolHandler.cs [dotnet-linker] Mark protocol interfaces when using the dynamic registrar. Fixes #12644. (#12737) 2021-09-16 08:16:39 +02:00
README.md Add some documentation. 2020-06-03 09:10:27 +02:00
SetupStep.cs Fixes for .NET 6 linker (#11739) 2021-06-14 20:10:29 -04:00
dotnet-linker.csproj Merge remote-tracking branch 'origin/net7.0-xcode14.1' into main-net7.0-xcode14.1 2022-11-03 08:21:55 +01:00
dotnet-linker.sln [tools] Add dotnet-linker, a project to contain custom linker steps for our net5.0 build. 2020-06-02 15:55:56 +02:00

README.md

Linker

This directory contains the custom linker steps for the managed linker when building Xamarin.iOS/tvOS/watchOS/macOS apps using .NET 5.

This is work in progress, and is not in a releasable state yet.