Age | Commit message (Collapse) | Author |
|
(#2284)
[main] Update dependencies from dotnet/runtime
|
|
(#2283)
[main] Update dependencies from dotnet/arcade
|
|
Enable nullable on Annotations.cs
Check for null after TryResolve using 'is' keyword in MarkStep()
|
|
* Warn on usage of attributes with annotated ctors
* PR feedback
Add ProducedBy from Test Restructure
Add support for SetupCompileBefore in the analyzer
Run analyzer tests on all members (not only methods)
Move tests to RequiresCapability
* Enable analyzer tests for attributes which use RUC annotated properties
* Lint
* Rename CheckAttributeCtor
Check for instantiations that set annotated properties
* Apply suggestions from code review
Co-authored-by: Andy Gocke <angocke@microsoft.com>
* Update comment
Rename Linker => Trimmer in ProducedBy
* Fix applied suggestions
* Lint
Co-authored-by: Andy Gocke <angocke@microsoft.com>
|
|
|
|
|
|
|
|
* Add MakeGenericMethod and MakeGenericType to the special incompatible members of the RUC analyzer.
* Don't produce diagnostics for MakeGenericMethod/MakeGenericType
* Add comment
* Lint
|
|
(#2254)
* Add support in RUC analyzer for new() constraint on generics
* Support `new()` constraint on types
* Use SyntaxNodeAnalysisContext for constructor constraints
* Lint
* Update justification
|
|
Basically a workaround for #2260. This simply goes back to using the `Resolve` method and avoid the cache for now.
|
|
This uncovers a null ref in sweepstep.
The test is order dependent:
- Assembly (librarywithnonemtpy) has a virtual method which referes to type from second library (library). This processes the type reference.
- The type is removed from library
- The virtual method is re-processed again -> hits a type def which does not belong to any assembly/scope
For this to happen the virtual method must be processed after the type has been removed.
This also requires the method to be meant for removal later on (the body will be rewritten to throw), since otherwise the type would have been marked.
This also requires the library with the removed type to be kept (so something else in it must be kept).
|
|
* PR feedback
* Remove unnecessary method
|
|
[main] Update dependencies from dotnet/arcade
- Workaround crashing analyzer
|
|
(#2262)
[main] Update dependencies from dotnet/runtime
|
|
|
|
This reverts commit 3e5edda958a88e799456ab787a16ff34b7df53e0.
|
|
* Nullable annotations part 1
Enable nullable annotations for LinkContext and the XML processing classes.
|
|
|
|
GitHub is removing support for unauthenticated git soon: https://github.blog/2021-09-01-improving-git-protocol-security-github/
|
|
|
|
* Enable nullable warnings for linker
* PR feedback
Remove assert
|
|
|
|
|
|
* Normalize warning messages
* Apply suggestions from code review
Co-authored-by: Sven Boemer <sbomer@gmail.com>
* Update expected logged message
Co-authored-by: Sven Boemer <sbomer@gmail.com>
|
|
This confuses IDE tests runners in different ways.
* In Rider, if two folders contain a test with the same name, only 1 will ever run. Rider silently drops the other and never runs it.
* In Visual Studio 2022 Preview the tests a grouped oddly in the UI. For example, tests under `Attributes.Csc.*` will appear as having their own top level grouping rather than nested under `Attributes`. I did not test if VS suffered from the above. It may also.
|
|
|
|
We are migrating our unit test projects to run on net5. However, we will continue to run our linker tests against a mono like profile (since that is what Unity is based on).
Eliminating PeVerifier entirely causes us problems. We want to continue running it on the linker test executables.
This PR refactors how PeVerifier is made to do nothing when compiling with NETCOREAPP defined. This approach lets the illink tests continue to operate as they do now. While also giving us the ability to run our `Unity.Linker.Tests` project on net5, our test case assemblies compiled against a .NET Framework profile, and have our test framework continue to run PeVerifier
|
|
|
|
(#2239)
[main] Update dependencies from dotnet/arcade
|
|
(#2240)
[main] Update dependencies from dotnet/runtime
|
|
This causes us problems with our test framework since our assembly containing additional test cases is called Unity.Linker.Tests.Cases.
|
|
|
|
* Validate unrecognized patterns against logged warnings
This changes the linker validation to check for unrecognized
reflection access patterns against logged messages. The plan is to do
the same for the analyzer tests, allowing us to make progress as we
replace UnrecognizedReflectionAccessPatternAttribute with
ExpectedWarningAttribute.
The UnrecognizedReflectionAccessPatternAttribute is now checked
against both the logged messages and recorded unrecognized reflection
patterns. We check that it matches the same number of patterns as
logged warnings for consistency. This required some changes to the
signature formats used for validation, since the signatures used in
this attribute now need to use the same format as the one we use for
logged warnings.
Changing the signature formats here uncovered some places where we
were still using the cecil signature format even for user-visible
warnings. These have been changed to use the format from
GetDisplayName.
Generic parameter dataflow validation treats the
UnrecognizedReflectionAccessPatternAttribute differently, using the
member name to refer to a generic type parameter. This inconsistency
has been lifted into a separate custom attribute argument that
specifies when the attribute refers to a generic
parameter. Non-generic method parameters had a similar problem, but
this was less common, so those usages were just replaced by
ExpectedWarningAttribute.
* PR feedback
- Continue returning cecil signature as fallback
(replace exception with a debug assert)
- Remove left-over logic from debugging
* Fix more tests
- Use display name signature format for MethodReference
- Revert changes that expect attributes to match only one warning
- Remove debug output
- Also add missing using
|
|
|
|
|
|
Runtime is trying to update to .NET 7 versioning, but this breaks linker since it hardcodes knowledge of all versions.
This change makes it forward compatible by recognizing "higher than what I know".
No test as there's not a really good way to test this without going through a lot of trouble. Tested locally with runtime targetting 7.0 versioning.
|
|
[main] Update dependencies from dotnet/runtime
- Add dotnet7 feed
|
|
(#2223)
[main] Update dependencies from dotnet/arcade
|
|
Add new error code for cases in which the static constructor is
annotated with RUC
Add IL2116 to error codes
Move static constructor verification in MarkField before pushing a new
stack to print warnings in the method caller instead of fields
Don't treat static constructors annotated with RUC as dangerous
Add test for several static constructor calls
Warn on field instead of warning on .cctor
* Field should warn no matter the DependencyKind except
DynamicallyAccessedMemberOnType
* Add test for Access to field via reflection, dynamic dependency and
using fields on attributes
Co-authored-by: vitek-karas <vitek.karas@microsoft.com>
|
|
* Support assembly as message origin
* Add tests
* Fix test failures
* Add missing file
* Update src/linker/Linker.Steps/MarkStep.cs
Co-authored-by: Mateo Torres-Ruiz <mateoatr@users.noreply.github.com>
Co-authored-by: Mateo Torres-Ruiz <mateoatr@users.noreply.github.com>
|
|
Cecil doesn't handle IL editing well. It doesn't patch scopes and branches. Added a linker-private IL processor which does this.
Added tests for the IL corruption when removing branches around code which has exception handlers.
I also removed now unnecessary test attribute, since in my previous change the exception handlers are now validated within the instruction stream, so no need for a second attribute to validate these.
Co-authored-by: Sven Boemer <sbomer@gmail.com>
|
|
(#2215)
[main] Update dependencies from dotnet/runtime
|
|
(#2214)
[main] Update dependencies from dotnet/arcade
|
|
* Fix warnings for DAMT on interfaces
https://github.com/mono/linker/pull/2191 addressed issues with redundant
warnings from base types, but interfaces need to be handled specially.
There were a few issues with the interface handling in that change:
- The binding logic didn't include interfaces for DAM.All when
declaredOnly was specified, as @vitek-karas pointed out in
https://github.com/mono/linker/pull/2206#discussion_r687573854.
This could have led to us not marking interfaces for types derived
from a DAMT.All-annotated type. Either way, the binding logic
should not select interface _members_ when declaredOnly is specified.
- The DAMT-on-type logic had special handling for base types, but
didn't separately mark interface members, which is needed when
applying annotations DAMT.All or DAMT.Interfaces. This could have led
to missing interface impls or interface members for types which have
(explicit or inherited) DAMT.All or DAMT.Interfaces annotations.
Separately, the bit operations on DAMT also didn't correctly handle cases
where there are bits shared by different enum members.
* Remove debug output
* Apply suggestions from code review
Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
|
|
The isinst optimization replaces that instruction with a pop, ldnull when the type is not instantiated. This changes the instruction and also changes the length of the instruction in that position. Cecil unfortunately doesn't update try/catch/filter references and they keep pointing to the old isinst instruction which not part of the method body anymore. When saving the assembly the offsets stores in the try/catch/filter records end up effective random and corrupted.
This is a short-term fix to unblock failures in runtime due to this problem.
Medium term fix would be to carefully handle all IL replacements in the linker with regard to try/catch/filter records.
Ideally the long term fix would be to do this in Cecil in such a way that IL replacements would be correctly handled on their own.
This fixes the Http3RequestStream failures mentioned in #2181, but I was not able to confirm if this fixes the CoreLib ArrayPool issues as well (I think it will not).
|
|
* Fix suppression check with assembly suppressions
The change in https://github.com/mono/linker/pull/2171 was incorrect
because it didn't account for the possibility that the suppressions
cache already contains assembly or module suppressions for the provider.
This fixes the check by re-using the cache to also track whether we have
scanned for suppression attributes on the provider. This caching is
necessary since we warn about duplicate suppressions.
Providers without any suppressions may still be scanned multiple times
since we don't cache the negative result.
* Populate cache eagerly to avoid extra state
Now whenever we add a record to the cache, we ensure that all of the
suppressions that might apply to the member have been discovered.
This way we don't need to track whether we have scanned the suppressed
member, but have to do a bit more work up-front.
* Use private accessibility
For methods only used in
UnconditionalSuppressMessageAttributeState
|
|
|
|
|
|
* Fix warnings for DAM.All
Fixes https://github.com/mono/linker/issues/2159
* Add tests
* PR feedback
- Remove unnecessary helper
* Avoid redundant DAM warnings for base members
* PR feedback
- Resolve -> TryResolve
- Avoid nested yield returns
- Testcases with base instantiated over self for generic parameter with
requirements
|
|
Property which marks itself via annotated attribute - leads to endless recursion in the linker.
|