Siegfried Pammer
2043e5dd6f
Add support for C# 12 primary constructors.
11 months ago
Siegfried Pammer
95108c967a
Fix #3108 : illegal nested classes in enums throw off EnumValueDisplayMode handling.
2 years ago
Daniel Grunwald
03bceed0c1
Fix #2397 : Introduced calls to Unsafe.Read or Unsafe.Write when we would otherwise cause "Cannot declare a pointer to a managed type T" errors.
2 years ago
ElektroKill
4601481dec
Add ILPretty test for MCS 2.6.4 fixed string
2 years ago
Daniel Grunwald
768cb02f0b
Fix #2964 : Better error message when a method only contains a single ret instruction.
2 years ago
Daniel Grunwald
94d2ce0fcf
Fix crash when control flow reaches end of method.
2 years ago
Siegfried Pammer
e5426bb803
Add missing EmbeddedAttribute in Unsafe.il testcase.
3 years ago
Standa Lukeš
6153f9cf35
Add test for indexer initializers
3 years ago
Standa Lukeš
18481efc44
Fix initialization of FakeProperty with setter
...
Seems like a typo - the setter method was assigned to the Getter property
The test GuessAccessors needed adjustments in the generated code.
ILSpy is more eager to merge property assignments
3 years ago
Siegfried Pammer
c5ff0cafc5
TransformInlineAssignmentStObjOrCall: Make sure no dead store is produced by the transform.
3 years ago
Siegfried Pammer
48a8351e27
Use Unsafe.SizeOf when taking the size of a managed type.
3 years ago
Siegfried Pammer
7e08c348b5
#2685 : Emit 'override' without 'newslot' as 'virtual' if there is no (known) method to override.
3 years ago
James May
4a1f79a32a
Assume conventionally named unresolved method references are properties or events.
...
eg. decompiles to .Property instead of .get_Property()
3 years ago
Siegfried Pammer
ec1b9a4ccd
Fix #2443 : do not use this()-ctor initializers by accident if base type is unknown.
4 years ago
Siegfried Pammer
bc5d078feb
Fix #1698 : Readonly auto properties from VB.NET are not properly decompiled
4 years ago
Siegfried Pammer
3f721a17c1
Add support for System.Runtime.CompilerServices.SpecialNameAttribute
4 years ago
Daniel Grunwald
f2d3f259fd
#2311 : Adjust test case for #1292 -- fixed statement is now correctly detected
4 years ago
Daniel Grunwald
6951ccb1a2
Fix #2260 : switch(string) transform: handle empty cases where the C# compiler optimizes out the `if`
...
e.g.
```
switch (<PrivateImplementationDetails>.ComputeStringHash(text2))
{
case 1288728352u:
_ = text2 == "rowno";
break;
...
```
5 years ago
Siegfried Pammer
a5858f1694
Add support for primary constructor syntax.
5 years ago
Siegfried Pammer
cc19e9043e
Fix #603 : Single element arrays should not span multiple lines
...
Fix #1079 : CSharpFormattingOptions.AutoPropertyFormatting has no effect
5 years ago
Daniel Grunwald
411457c4c7
#1240 : Add support for Unsafe comparison intrinsics: `AreSame`, `IsAddressLessThan`, `IsAddressGreaterThan`
5 years ago
Daniel Grunwald
6e8c1b3117
ILReader: support comparison between StackType.Ref and StackType.I
...
Update Unsafe.il tests to .NET 5.0 version.
5 years ago
Daniel Grunwald
782e4ae88c
Fix #2215 : Use `Unsafe` intrinsics for `ldobj`/`stobj` instructions.
...
Use `Unsafe.As` to adjust the type of a managed reference if necessary (without converting to a pointer type).
This also adds support for the `ReadUnaligned`/`WriteUnaligned` intrinsics.
5 years ago
Daniel Grunwald
54231edb4b
Fix #2189 : Invalid C# generated when pinning an unmanaged pointer.
...
C# has some special rules for allowed expressions inside a fixed statement.
In the non-allowed cases, emit an `Unsafe.AsRef()` call to prevent compiler errors.
5 years ago
Siegfried Pammer
be57dc454c
Run tests with different versions of Roslyn
5 years ago
Daniel Grunwald
80cf72e498
#2182 : Move "Transform call to struct constructor" from EarlyExpressionTransforms to ILReader.
...
This fixes the evaluation order for such calls (and an assertion in StObj.CheckTargetSlot).
5 years ago
Daniel Grunwald
47685c4b57
Fix weird casts to `nint` when writing to fields of unknown type.
5 years ago
Daniel Grunwald
6010757d22
Add support for .NET 5 custom calling conventions.
5 years ago
Daniel Grunwald
836bc37050
Upgrade ilasm.exe version. This allows us to write tests for the new function pointer calling conventions.
5 years ago
Siegfried Pammer
8e9ecf6c36
Fix #2162 : handle VariableInitializers like AssignmentExpressions in InsertParenthesesVisitor
5 years ago
Daniel Grunwald
63d1f5bb09
Adjust old `calli` test case to new function pointer syntax
5 years ago
Daniel Grunwald
9381be2280
#2158 : Fix decompilation of arithmetic on managed pointers after ConversionKind.StartGCTracking.
5 years ago
Siegfried Pammer
1b47acfde7
Fix build.
5 years ago
Daniel Grunwald
0e1c24464f
Fix #2148 : Don't attempt to detect `fixed` statement for pinned value types
5 years ago
Siegfried Pammer
f245d93fef
#2128 : Adjust formatting settings used in tests to match our new style.
5 years ago
dotnet format
0d9f871a4f
#2128 : Reformat the whole code base.
5 years ago
Siegfried Pammer
15028b3669
Fix #2104 : Check field name of backing field when attempting to transform to an auto property.
5 years ago
Daniel Grunwald
f5409ebe31
Fix re-pinning getting confused about which variant of the pinned local to use when the new re-pinned reference depends on the old pinned reference.
5 years ago
Daniel Grunwald
3e6e628483
Fix missing conversion on ref-reassignment.
5 years ago
Daniel Grunwald
ddff831cf0
#1292 : Fix some more problems with pinned locals.
...
Let's distinguish between the original pinned locals and the PinnedRegion locals.
The format need declarations if any are left over after transformations; the latter don't.
5 years ago
Daniel Grunwald
c6b10d3ec3
Fix #2094 : ByteOffset() arguments passed in wrong order
5 years ago
Daniel Grunwald
3a4db502bc
Add support for arithmetic using C# 9 native integer types.
5 years ago
Daniel Grunwald
a0b144d332
Use `Unsafe.AsPointer()` for `ConversionKind.StopGCTracking`.
5 years ago
Daniel Grunwald
35c405b973
Translate the initializer of a `fixed` statement as managed reference and only apply the ref-to-pointer conversion at the end.
...
This way we create compilable code when the pinned variable type does not match the initializer type.
5 years ago
Daniel Grunwald
a9d643b208
Emit a call to `ref Unsafe.As<TFrom, TTo>(ref TFrom)` when the IL code contains a mismatch of managed reference types.
...
The previously emitted `ref *(TTo*)(&source)` only compiles when `source` is a local variable; otherwise C# complains about the memory not being pinned.
Note that we special-case local variables to keep the previous behavior around; this avoids pulling in `System.Runtime.CompilerServices.Unsafe.dll` when it's unnecessary.
5 years ago
Daniel Grunwald
2c0554f129
Fix #1963 : Support decompiling `calli` instructions into C# 9 function pointer syntax.
5 years ago
Daniel Grunwald
65fe59e393
#1918 : Fix a bunch of issues with pinned region detection.
...
Not every pinned region has a clean `P = null` assignment to mark its end.
If a second pinned region starts with the same variable `P`, consider that to mark the end of the previous pinned region for that variable.
Also, fix a bunch of special cases with empty pinned regions.
5 years ago
Daniel Grunwald
ad5ba9295e
Fix #1924 : preserve hexadecimal format when converting literal to wider type
5 years ago
Daniel Grunwald
7326a69823
Fix #1795 : `InvalidCastException: Cast from Boolean to Int64 not supported` when decompiling enum with bool constants
6 years ago
Daniel Grunwald
5847d87651
Adjust tests: test runner now adds+removes TargetFramework attribute
6 years ago