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-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-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-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-30Add support for generic attributes (#871)Sven Boemer
* Add support for generic attributes * Compile test assembly against mscorlib To satisfy PEVerify
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-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>
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-03Fix handling of empty string constants (#776)Jb Evain
2021-07-02Preserve LargeAwareAddress image flag (#775)Jb Evain
2021-06-30Avoid decompressing/compressing unresolved embedded source information (#771)Jb Evain
2021-06-24Add support for reading symbols of modules with multiple codeview debug ↵Jb Evain
entries (#770)
2021-04-24Fix resolving from a ModuleReference (#730)AnakinSklavenwalker
* add failing test * Fix resolving from netmodules Co-authored-by: Jb Evain <jb@evain.net>
2021-03-16Implement automatic handling of the HasFieldRVA field attribute. (#733)Jeremy Koritzinsky
* Implement automatic handling of the HasFieldRVA field attribute. Fixes #728 * Add FieldDefinition.HasFieldRVA Co-authored-by: Jb Evain <jb@evain.net>
2021-03-13Fix reading GenericInst constants in portable pdbs (#729)Jb Evain
* Fix reading GenericInst constants in portable pdbs * Add test
2021-02-12Add ModuleDefinition.ImmediateRead (#713)Mike Voorhees
We are going to use this to do a multi stage load in parallel. We will be able to greatly reduce our load times using this new API. The way it's going to work is Stage 1 - In parallel, load the assemblies with ReadingMode.Deferred. Stage 2 - Populate our AssemblyResolver with a cache of all read assemblies. Stage 3 - In parallel, call ImmediateRead. What I really want is an API to load everything in stage 3. I found that ImmediateRead does not load method bodies. I don't know if/how you want want something like this exposed via the public API. For now I'm iterating the data model and forcing things to load that ImmediateRead did not cover.
2021-02-12revert layout change (#720)Mike Voorhees
* Revert "Refactor AddLayoutInfo" This reverts commit 6070fe78e62b743eaed7bb9a6675f8170e4e27e6. * Revert "Add a ClassLayoutTable row for structs with no instance fields" This reverts commit 8f2b91726578075e4fb49d6d5759c4cd4495d0a5.
2021-02-12Fix type reference name in attribute argument getting mangled when such ↵Mike Voorhees
attribute is put on a method in a projected type. (#722) Co-authored-by: Tautvydas Žilys <tautvydas.zilys@gmail.com>
2021-01-07Allow removing value of ModuleDefinition::EntryPoint (#711)Marek Safar
* Allow removing value of ModuleDefinition::EntryPoint * PR feedback
2020-10-15A minimum tactical fix for issue #697 (#698)Steve Gilham
* Provoke the issue * Minimum fix (cherry picked from commit 0f23047c62027e10206a5d0dbb81cba6f2dc260f) * Revert "Provoke the issue" This reverts commit 1a2275b7f6704298fa386fa416c91bb09f0368bf. * Add unit test (cherry picked from commit 185ba884111e30cfb84aeb64f00324d995cfdd35) * Use existing infrastructure * Quick fix Co-authored-by: Jb Evain <jb@evain.net>
2020-10-13Add failing test for #694 (#695)Lucas Trzesniewski
Co-authored-by: Jb Evain <jb@evain.net>
2020-10-13Revert "Fix ReadSymbols in a Module that is already created (#686)"Jb Evain
This reverts commit 191f9fc0a79a138fdb634fbb51cf836a86b4e565.
2020-09-16Fix ReadSymbols in a Module that is already created (#686)Thays Grazia
* When I try to use ReadSymbols in a Module that is already created, for example: var symbolReader = portablePdbReaderProvider.GetSymbolReader(asm.image, stream); asm.image.ReadSymbols(symbolReader); method.debug_info has a list, but it's empty, so it wasn't entering in the if, but it should, maybe we should change de if to method.debug_info == null || method.debug_info.count = 0. * Adding test. * Fix styling. * Typo Co-authored-by: Jb Evain <jb@evain.net>
2020-09-16Better way to update local scopes when method bodies are edited (#687)Vitek Karas
* Better way to update local scopes when method bodies are editted This change will make sure that all local scopes are resolved (they refer to instructions directly and don't rely on instruction offset alone) then fixup local scopes by simply updating instruction references. Added better tests to validate that the behavior is correct across PDB write/read and some variations of the resolved/unresolved scopes behavior. * Fix crash with null local scope
2020-09-16Unity's Windows Runtime changes (#394)Tautvydas Žilys
* Implemented Windows Runtime projections for implemented interface overrides. * Don't redirect Windows Runtime projected methods on interfaces. * Add additional test cases for Windows Runtime interface projection. * Fix reading interface impl attributes when using immediate reading mode. * Do not project for windows runtime during read. A type will not be fully initialized during read, so don't attempt to project for Windows runtime until after all of the metadata reading is correct. If a type reading for a module is no completed, a call to BinaryRangeSearch in MetadataSystem can fail, because some of the entries in the types array will still be null. * Fix build warnings. * Remove method that got duplicated during a cherry pick. * Fixed an issue with MethodReferenceComparer where it would incorrectly identify two method references to be the same if they had the same declaring types, the same parameter counts and were both unresolvable. * Sync up latest changes to MethodReferenceComparer and TypeReferenceEquality comparer and also add tests for them. * Fix code formatting. * Remove extra char * Style fix Co-authored-by: Ignas Ziberkas <ignas@unity3d.com> Co-authored-by: Josh Peterson <petersonjm1@gmail.com> Co-authored-by: Jb Evain <jb@evain.net>
2020-07-24Automatically update local variable debug info (#676)Vitek Karas
* Automatically update local variable debug info When manipulating the local variables collection on a method body, automatically update the debug info for all affected local variables. When removing a local variable, also remove the debug info for that local variable from the scopes. When removing or inserting update the indeces of local variable debug infos which are afected by the action. Note the local variable debug info either holds just a backpointer to the local variable in which case it doesn't store the index at all (and thus nothing to do), or it stores the index explicitly in which case it needs to be updated. Added tests for both insert and remove cases. * Add internal properties on `VariableOffset` to make it easier to manipulate it. Reworked the `UpdateVariableIndeces` to only loop over variables once and also to handle removal of resolved variable debug infos. * Simplify the code a little and add comments * PR feedback
2020-07-23Auto update local scopes in debug info when manipulating instructions (#677)Vitek Karas
* Auto update local scopes in debug info when manipulating instructions Before this change Cecil would not update local scopes when manipulating mehod bodies. This can lead to corrupted debug info - which when written to a PDB results in corrupted PDB. Cecil can store local scopes in two ways: * Using IL offset numbers - this is how pretty much all of the symbol readers populate the OMs. * Using references to instructions. If the local scopes use offset values this change will update the local scopes for all insert and remove operations on the method body. The behaviors for insert is basically "insert after" in that the new instruction is added to the scopes of the previous instruction. If the local scopes are using instructions directly the change only removes any references to instructions which are being removed from the method body (and replaces them with the instruction offset value). To be able to tell the difference between these cases the instruction field has been made internal in the InstructionOffset structure. * Add `IsResolved` to the `InstructionOffset` to make the code more readable. Note: Still have to keep the `instruction` field visible to handle the case of removing a resolved instruction offset reliably (since most resolved instructions will have the numerical offset 0). * Add internal property on `InstructionOffset` to be able to keep all its fields private. * Improve comments in the code.
2020-05-21Add Clear to ILProcessor (#662)MichalPetryka
2020-02-13Changing PdbReaderProvider to accept create EmbeddedPDB from stream. (#648)Thays Grazia
* Changing GetSymbolReader from PdbReaderProvider, when we create a Module from stream we don't have the filename, and it's not necessary to create an EmbeddedPortablePdbReaderProvider, so I've moved the check to after the creation of EmbeddedPortablePdbReaderProvider.
2020-01-31Fix locally scoped constant array (#644)Simon Cropp
* add failing test for LocallyScopedConstantArray * add LocallyScopedConstantArray target assembly * ElementType.Array should be treated the same as object in ReadLocalConstant * assert constant is null * Style fixes Co-authored-by: Jb Evain <jb@evain.net>
2019-12-16Add index based method to ILProcessorMarek Safar
This makes it simpler to work with it when the instruction positions are known in advance.
2019-12-10Allocate GenericArguments collections with the right sizesJb Evain
2019-10-18Add new places to look for peverifyJb Evain
2019-10-18Fix invalid ComputeHash from ByteByffer array computationJerome Laban
2019-06-29Don't verify attributes on generic constraints on MonoJb Evain
2019-06-25Add test for attributes on generic parameter constraintsJb Evain
2019-06-21Add support for custom attributes on generic constraintsJb Evain
2019-06-01Add test for deterministic scenarioJb Evain
2019-03-05Remove extra endifsJb Evain
2019-03-05Remove support for the readonly builds as they don't make sense in a nuget worldJb Evain
2019-02-12Run symbols tests in ReadOnly mode as wellJb Evain
2019-02-12Remove NET_4_0 define; If needed we can now use the dotnet core provided oneJb Evain
2019-02-12Fix tests on dotnet core / macosJb Evain
2019-02-12Fix running import cecil tests on net40Jb Evain
2019-02-12Move caller attribute togetherJb Evain
2019-02-12We're only compiling cs filesJb Evain
2019-02-12Fix getting test resource path from test subprojectsJb Evain
2019-02-12Move to SDK style projectsJb Evain