Age | Commit message (Collapse) | Author |
|
Enable CodeQL with TSA
|
|
|
|
Microsoft.DotNet.Cecil and Microsoft.DotNet.Cecil.Pdb are only internal packages (#48)
|
|
Delete double source build manage run
|
|
linker (#45)
|
|
Microsoft.DotNet.Arcade.Sdk
From Version 8.0.0-beta.22512.1 -> To Version 8.0.0-beta.22513.2
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
|
|
|
|
Microsoft.DotNet.Arcade.Sdk
From Version 8.0.0-beta.22473.1 -> To Version 8.0.0-beta.22512.1
|
|
Add some files to run SourceBuild in linux
**DISABLE_SECRET_SCANNING**
|
|
Add eng/Version.Details.xml
Make build.sh and eng/common/build.sh read execute files
|
|
|
|
Add arcade infrastructure to dotnet/cecil
Adds eng/common folder from arcade
Adds NuGet.config file with the dotnet eng/tools/public package sources
Adds build scripts at root level to execute the eng/common/build scripts
Adds eng/Versions.props and eng/Version.Details.xml files with minimal dependencies since Cecil doesn't require anything, mostly just setting up the package version
Adds global.json
Adds arcade artifacts to .gitignore file
Add Microsoft.Dotnet.Arcade.Sdk
Make Mono.Cecil a package
Remove frameworks non-compatible with Arcade SDK
Make the package non-shippable so it doesn't publish in Nuget
Suppress license validation since Cecil has a different license than MIT one
Workaround the publickey and publickey token generation from arcade
Modify version to match Cecil version 0.11.4.0
Remove helix SDK since we don't use helix testing
Add pipeline yaml file
Add support for NetCoreAppToolCurrent equals to net7.0 and ToolsFramework netstandard 2.0
Add a variable to find the resources folder given that there is a new structure in the artifacts directory
Use VS test runner to avoid running tests using xunit
Add signing properties for 3rd party libraries
|
|
|
|
|
|
* Address issue #873
* Be explicit as to what we support writing
* Use normal test infrastructure
* Restore writing primitives
* Restore style
* Can't verify .net core assembly
Co-authored-by: Jb Evain <jb@evain.net>
|
|
In .NET Core 3.0 and later, `MethodImplOptions` got a new flag value,
`AggressiveOptimization` (512).
This adds that same flag to `MethodImplAttributes` (and a corresponding
property to `MethodDefinition`). It also updates the comments for the
flags to match the `MethodImplOptions` documentation better.
|
|
property. (#843)
We found a rare race condition between `MethodDefinition.HasOverrides` and `MethodDefinition.Overrides`.
What can happen is
1) Thread 1 get's past the null check in `MethodDefinition.HasOverrides` and then is suspended.
2) Thread 2, calls `MethodDefinition.Overrides` and executes at least as far as the `metadata.RemoveOverrideMapping (method)` call in `AssemblyReader.ReadOverrides`
3) Thread 1 resumes on `return HasImage && Module.Read (this, (method, reader) => reader.HasOverrides (method));` It now proceeds to AssemblyReader.HasOverrides. No overrides are found and false is returned due to the overrides for that method having been removed from `MetadataSystem`
To recap, the two notable behaviors are triggering this are
a) The following check in `MethodDefinition.HasOverrides` happens outside of the lock.
```
if (overrides != null)
return overrides.Count > 0;
```
b) The call to `metadata.RemoveOverrideMapping` in `AssemblyReader.ReadOverrides` means that `AssemblyReader.ReadOverrides` and `AssemblyReader.HasOverrides` cannot be called again after the first call to `AssemblyReader.ReadOverrides`
I did not attempt to reproduce this vulnerability for every pair of properties that follows this pattern. However, I think it's safe to assume any pair of properties that follows this same pattern is vulnerable.
Using `ReadingMode.Deferred` also appears to be a required prerequisite to encounter this problem.
We had two thoughts on how to fix this
1) Repeat the collection null check after obtaining the module lock in `Module.Read` during `MethodDefinition.HasOverrides`
2) Remove the behavior of `AssemblyReader` removing data from the `MetadataSystem`.
I decided to go with Fix 2 because it was easy to find all of problematic property pairings by searching `MetadataSystem.cs` for `Remove`. I also feel that this behavior of modifying the metadata system is asking for problems and probably not worth the freed memory is provides.
If you'd prefer Fix 1 instead. Or both Fix 1 & Fix 2 let me know and I can change around the PR.
|
|
This sets up .NET naming for fields, locals and parameters to use
snake_case, so that editors won't complain about those.
It also disables trimming of trailing blanks to avoid accidentally
including such whitespace diffs in PRs.
|
|
* ILProcessor should also update custom debug info (#34)
* ILProcessor should also update custom debug info
When eidting IL with ILProcessor various pieces of debug information have references to the origin IL instructions. These references can be either resolved (point to Instruction instance), in which case the editting mostly works, or unresolved (store IL offset only) in which case they need to be resolved before the editting can occur (after the edit the original IL offsets are invalid and unresolvable).
This is effectively a continuation of https://github.com/jbevain/cecil/pull/687 which implemented this for local scopes. This change extends this to async method stepping info and state machine scopes.
The change refactors the code to make it easier to reuse the same logic between the various debug infos being processed.
Updated the existing tests from https://github.com/jbevain/cecil/pull/687 to include async and state machine debug info (completely made up) and validate that it gets updated correctly.
* PR Feedback
Renamed some parameters/locals to better match the existing code style.
* PR Feedback
* Fix test on Linux
Native PDB is not supported on Linux and the test infra falls back to portable PDB automatically. Since the two PDB implementations read the custom debug info from a different place the test constructing the input needs to adapt to this difference as well.
|
|
entries. (#869)
Basically the first two entries are written correctly, and any after that which has data will have the RVA correct, but the virtual address field will be wrong. Depending on the consumer this can work (if they use RVA) or fail (if they use virtual address) as they would read garbage data.
Currently this mostly affects embedded protable PDBs since in that case we write 4 headers: CodeView, PdbChecksum, EmbeddedPdb and Deterministic (in this order), so the embedded PDB data is effectively wrong.
Also adds a test which validates that both the RVA and virtual address point to the same thing.
|
|
(#870)
* Use InvariantCulture for operand to string conversion in Instruction.ToString()
|
|
* Add support for generic attributes
* Compile test assembly against mscorlib
To satisfy PEVerify
|
|
|
|
entries (#35)
|
|
* ILProcessor should also update custom debug info
When eidting IL with ILProcessor various pieces of debug information have references to the origin IL instructions. These references can be either resolved (point to Instruction instance), in which case the editting mostly works, or unresolved (store IL offset only) in which case they need to be resolved before the editting can occur (after the edit the original IL offsets are invalid and unresolvable).
This is effectively a continuation of https://github.com/jbevain/cecil/pull/687 which implemented this for local scopes. This change extends this to async method stepping info and state machine scopes.
The change refactors the code to make it easier to reuse the same logic between the various debug infos being processed.
Updated the existing tests from https://github.com/jbevain/cecil/pull/687 to include async and state machine debug info (completely made up) and validate that it gets updated correctly.
* PR Feedback
Renamed some parameters/locals to better match the existing code style.
* PR Feedback
|
|
Fixes jbevain/cecil#842.
|
|
Fix reading some pdb generated by the C++ compiler for mixed mode assemblies.
Co-authored-by: Marco Rossignoli <mrossignol@microsoft.com>
|
|
|
|
* Fix custom attribute with enum on generic type
Fixes both the reader and the write to correctly handle values of type enum on a generic type.
Cecil represents generic instantiations as typeref which has etype GenericInst, so the exising check for etype doesn't work. Also since attributes only allow simple values and enums (and types), there's technically no other way to get a GenericInst then the enum case.
Added several test for various combinations of boxed an unboxed enums on generic type.
Added a test case provided by @mrvoorhe with array of such enums.
* Disable the new tests on .NET 4
The CodeDom compiler doesn't support parsing enums on generic types in attributes (uses the "old" csc.exe from framework).
|
|
|
|
|
|
This reverts commit ff616bf90e3aff2292a0b1536f7af13cd8810276.
|
|
This reverts commit e04f1418730bdd7c8c46a13118f0cb1b5603997c.
|
|
* Fix deterministic MVID and add PdbChecksum (#31)
* Fix how pdb path is calculated in the tests
* Fix portable PDB stamp in CodeView header (#32)
* Introduce ISymbolWriter.Write
This mostly cleans up the code to make it easier to understand. `ISymbolWriter.GetDebugHeader` no longer actually writes the symbols, there's a new `Write` method for just that.
The assembly writer calls `Write` first and then the image writer calls `GetDebugHeader` when it's needed.
This is partially taken from https://github.com/jbevain/cecil/pull/617.
|
|
* Harden debug scope update logic
Based on bug reports like #816 it seems there are still cases where the IL and scope offsets are out of sync in weird ways. This change modifies the logic to have no potential to cause the `IndexOutOfRangeException`. While I was not able to determine what combination could cause this, it's better this way.
The corner case comes when there's potential problem with the first/second instruction in the method body. The change in this case will potentially make the debug scopes slightly wrong by not pointing to the previous instruction (as there's none). Without having a real repro it's hard to tell what would be a better solution, this way it won't crash and the scopes still make sense.
* Fix typo
|
|
* FieldRVA alignment
In support of dotnet/runtime#60948 the linker (an assembly rewriter) will need to be able to preserve the alignment of RVA based fields which are to be used to create the data for `CreateSpan<T>` records
This is implemented by adding a concept that RVA fields detect their required alignment by examining the PackingSize of the type of the field (if the field type is defined locally in the module)
* Update Mono.Cecil.Metadata/Buffers.cs
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
* Enhace logic used to ensure type providing PackingSize is local to the module.
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
|
|
|
|
with nested types (#801)
* Add support for generating the method and generic method comment signature with nested types from Xiao Luo
* Use type.GenericParameters.Count instead of custom method
|
|
|
|
|
|
|
|
* Pose the problem
* Quick and v dirty fix
* A better and more targeted fix (to fix the previous fix)
|
|
Bring in latest changes from upstream
|
|
since is detected as a package downgrade and a failure in newer SDKs
|
|
|
|
|
|
|
|
|
|
|
|
|