Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-08Merge pull request #49 from mdh1418/enable_codeqlHEADmainMitchell Hwang
Enable CodeQL with TSA
2022-11-03Enable CodeQL with TSAmdh1418
2022-10-24Rename packages to not clash with the official cecil package name, ↵Tlakaelel Axayakatl Ceja
Microsoft.DotNet.Cecil and Microsoft.DotNet.Cecil.Pdb are only internal packages (#48)
2022-10-21Update azure-pipelines.yml (#46)Tlakaelel Axayakatl Ceja
Delete double source build manage run
2022-10-21Add Mono.Cecil.Pdb as a package otherwise NativePdb reading will fail in ↵Tlakaelel Axayakatl Ceja
linker (#45)
2022-10-21Update dependencies from https://github.com/dotnet/arcade build 20221013.2 (#44)dotnet-maestro[bot]
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>
2022-10-14Add publishing props to cecil (#43)Tlakaelel Axayakatl Ceja
2022-10-14Update dependencies from https://github.com/dotnet/arcade build 20221012.1 (#42)dotnet-maestro[bot]
Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.22473.1 -> To Version 8.0.0-beta.22512.1
2022-10-11Source build fix in linux (#41)Tlakaelel Axayakatl Ceja
Add some files to run SourceBuild in linux **DISABLE_SECRET_SCANNING**
2022-10-11Remove .xml files from the .gitignore file (#40)Tlakaelel Axayakatl Ceja
Add eng/Version.Details.xml Make build.sh and eng/common/build.sh read execute files
2022-10-10**BYPASS_SECRET_SCANNING** (#39)Tlakaelel Axayakatl Ceja
2022-10-06Add arcade infrastructure to dotnet/cecil (#37)Tlakaelel Axayakatl Ceja
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
2022-10-06Merge pull request #38 from marek-safar/syncMarek Safar
2022-10-06Merge remote-tracking branch 'upstream/master' into syncMarek Safar
2022-09-30Address issue #873 (#874)Steve Gilham
* 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>
2022-09-30Add `MethodImplAttributes.AggressiveOptimization` (#855)Tim Van Holder
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.
2022-09-30Fix a race condition between certain Has properties and their collection ↵Mike Voorhees
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.
2022-09-30Add more style configuration (#854)Tim Van Holder
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.
2022-09-30ILProcessor should also update custom debug info (#867)Vitek Karas
* 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.
2022-09-30Fix corrupted debug header directory entry when writing multiple such ↵Vitek Karas
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.
2022-09-30InvariantCulture for operand to string conversion in Instruction.ToString() ↵Fantoom
(#870) * Use InvariantCulture for operand to string conversion in Instruction.ToString()
2022-09-30Add support for generic attributes (#871)Sven Boemer
* Add support for generic attributes * Compile test assembly against mscorlib To satisfy PEVerify
2022-08-23Add support for generic attributes (#36)Sven Boemer
2022-07-19Fix corrupted debug header directory entry when writing multiple such ↵Vitek Karas
entries (#35)
2022-06-23ILProcessor should also update custom debug info (#34)Vitek Karas
* 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
2022-06-15Add `Unmanaged` calling convention (#852)Tim Van Holder
Fixes jbevain/cecil#842.
2022-06-15Fix mixed module ReadSymbols() (#851)Marco Rossignoli
Fix reading some pdb generated by the C++ compiler for mixed mode assemblies. Co-authored-by: Marco Rossignoli <mrossignol@microsoft.com>
2022-02-22Merge remote-tracking branch 'upstream/master'Marek Safar
2022-02-22Fix custom attribute with enum on generic type (#827)Vitek Karas
* 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).
2022-01-28Add public API for instruction clonningMarek Safar
2022-01-20Merge remote-tracking branch 'upstream/master'Marek Safar
2022-01-20Revert "Fix deterministic MVID and add PdbChecksum (#31)"Marek Safar
This reverts commit ff616bf90e3aff2292a0b1536f7af13cd8810276.
2022-01-20Revert "Fix portable PDB stamp in CodeView header (#32)"Marek Safar
This reverts commit e04f1418730bdd7c8c46a13118f0cb1b5603997c.
2022-01-20Fix deterministic MVID and add PdbChecksum (#810)Vitek Karas
* 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.
2022-01-20Harden debug scope update logic (#824)Vitek Karas
* 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
2022-01-20FieldRVA alignment (#817)David Wrighton
* 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>
2022-01-14Switch to netcoreapp3.1 for tests (#823)Jb Evain
2022-01-13Add support for generating the method and generic method comment signature ↵Michael Jin
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
2021-12-09Merge remote-tracking branch 'upstream/master'Marek Safar
2021-11-29Fix portable PDB stamp in CodeView header (#32)Vitek Karas
2021-11-11Fix deterministic MVID and add PdbChecksum (#31)Vitek Karas
2021-08-13Addressing issue #781 (#782)Steve Gilham
* Pose the problem * Quick and v dirty fix * A better and more targeted fix (to fix the previous fix)
2021-07-26Merge pull request #30 from jbevain/masterAlexander Köplinger
Bring in latest changes from upstream
2021-07-22Update the version of Microsoft.NETFramework.ReferenceAssemblies.net40 (#787)Tlakaelel Axayakatl Ceja
since is detected as a package downgrade and a failure in newer SDKs
2021-07-03Fix handling of empty string constants (#776)Jb Evain
2021-07-02Bump to 0.11.4Jb Evain
2021-07-02Preserve LargeAwareAddress image flag (#775)Jb Evain
2021-07-01Prevent an exception if a string local constant is invalid (#774)Jb Evain
2021-07-01Merge remote-tracking branch 'upstream/master'Marek Safar
2021-07-01Remove unused field (#772)Jb Evain