sonyps5201314
cae466e5b0
Make `ILSpy` support `struct` and `record struct` types declared with a primary constructor and containing other constructors.
...
Here's an example:
```cs
public record struct CopilotContextId_RecordStruct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_RecordStruct() : this(Guid.NewGuid())
{
}
}
public struct CopilotContextId_Struct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_Struct() : this(Guid.NewGuid())
{
}
}
```
5 months ago
sonyps5201314
89c7e59176
Fixed an issue where the `record struct` type declared with a primary constructor could not be decompiled correctly. The reason was that `HandleInstanceFieldInitializers` did not support the `struct` type, but `DetectPrimaryConstructor` did not exclude it in advance.
...
Here's an example:
```cs
public record struct CopilotContextId_RecordStruct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_RecordStruct() : this(Guid.NewGuid())
{
}
}
```
5 months ago
sonyps5201314
9a4e49a7d4
Fixed an issue where the "CopilotQueriedScopeMention" type in "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\Microsoft.VisualStudio.Copilot.Contracts\Microsoft.VisualStudio.Copilot.dll" could not be decompiled correctly after expanding the judgment logic of IsPrimaryConstructor.
5 months ago
sonyps5201314
554ec92e73
Fix the issue where parameters in the base class constructor call are not passed correctly for inherited classes declared using the primary constructor form (e.g., the `DeserializationException` type in RestSharp), and also fix the subsequent issue where an extra parenthesis '()' is output if the base class is an interface (e.g., the `XmlRestSerializer` type in RestSharp).
6 months ago
sonyps5201314
828fb52390
`IsBaseCtorCall` no longer checks the number of parameters. Otherwise, it would cause the translation of the `DeserializationException` type in ` https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Serializers/DeseralizationException.cs ` to fail, as it is a primary constructor declaration that calls a base constructor with two arguments.
...
Additionally, dotPeek's `IsPrimaryConstructorFast` function has been introduced. This is because, after the aforementioned modification to `IsBaseCtorCall`, the `NamedParameter` type in RestSharp was being incorrectly identified as a primary constructor. Without this correction, it would lead to many compilation errors.
6 months ago
sonyps5201314
8d1cfee963
The internal judgment logic of IsPrimaryConstructor should exclude the copy constructor first, otherwise it will be judged incorrectly whether the NamedParameter type in https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/Parameter.cs uses the primary constructor.
6 months ago
sonyps5201314
10ce064833
Fixed the issue where the DefaultParameters type in https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/DefaultParameters.cs was incorrectly judged as to whether the primary constructor was used due to incorrect initialization logic of isStruct and isInheritedRecord in the constructor of the RecordDecompiler class.
6 months ago
sonyps5201314
aae1a28895
The IsPrimaryConstructor function is reimplemented based on some of dotPeek's judgment rules and the definition and characteristics of the primary constructor. However, it is found that dotPeek's judgment logic is also problematic. For example, it does not support the following scenario: ``` class WebPair(string name, string? value, ref readonly object encode) { public string Name { get; } = name; public string? Value { get; } = value; string? WebValue { get; } = encode is null ? "111" : value; string? WebValue2 { get; } = encode.ToString(); } ```
6 months ago
sonyps5201314
e8f32ec592
Fixed the issue where IsPrimaryConstructor's judgment was too conservative, which resulted in the inability to generate correct code in many scenarios.
6 months ago
Siegfried Pammer
126e870a5a
Fix #3577 : Properly infer the switch governing type and preserve conversions
6 months ago
Christoph Wille
4f11813829
.NET 10 RC2 packages ( #3599 )
...
Note: transport feed had only 106 for dotnet-format and ILCompiler.Reflection.ReadyToRun.Experimental
6 months ago
Siegfried Pammer
c075f7b9c8
Fix out var for expressions appearing in a lambda and not in a statement.
6 months ago
Siegfried Pammer
d11c40719d
#3569 : Don't move out variable declarations out of lambdas.
6 months ago
Siegfried Pammer
d736b02e2b
Fix #3480 : assert at ExpressionBuilder.BuildArrayInitializerExpression with properties that are not C# indexers, but parameterized properties.
6 months ago
Siegfried Pammer
b403b7bb3d
Fix #3542 : Invalid explicit cast for implicit conversion to generic struct with interface type constraint
6 months ago
Jeremy Pritts
b50f4e1d72
Enable detection of .NET version without TargetFrameworkAttribute ( #3580 )
6 months ago
ds5678
dc3ed43dd8
Do not create object initializers for tuples
6 months ago
Siegfried Pammer
7b03606402
Fix #3575 : Uses of compiler-generated events getting swapped with non-generated events of same type
6 months ago
ds5678
df9cc3dfbe
Null forgiveness for UsingScope
6 months ago
ds5678
c54318173b
Fix lower case type name conflicting with variable name
6 months ago
Siegfried Pammer
61f82d0c2d
Fix #3563 : Add support for ildasm /caverbal format
7 months ago
Siegfried Pammer
0e1478ffce
Fix #3564 : extend TransformDisplayClassUsage.IsPotentialClosure to support sibling DisplayClasses calling each other.
7 months ago
Siegfried Pammer
9b0e3a1605
Fix folding of local functions, if "Fold all braces" is disabled.
7 months ago
ds5678
1d964bce8e
Fix regression in decompiling local functions with default parameters
7 months ago
Siegfried Pammer
7f84d24167
Add support for new extension everything encoding.
7 months ago
Jeremy Pritts
d1dc7b258a
Copy-propagate the stack slot for collection initializers ( #3554 )
...
* Copy-propagate the stack slot for collection initializers
* Use pattern matching
7 months ago
Siegfried Pammer
17a533647b
Add C# 14 ExtensionMarkerAttribute
7 months ago
Siegfried Pammer
732f285c41
Rename KnownAttributes.RequiredAttribute to KnownAttributes.Required
7 months ago
Siegfried Pammer
e34db06a67
Fix #3543 : Missing parentheses around field assignment expression in list initializers
7 months ago
Siegfried Pammer
6aa9bd8e5e
Fix #3549 : Do not crash on encountering nil tokens.
7 months ago
Siegfried Pammer
48ff85178d
#3545 : Properties must have a getter for covariant returns to be applicable.
7 months ago
Siegfried Pammer
3442fad4a0
Fix #3545 : Covariant return not detected for abstract override property
7 months ago
Siegfried Pammer
3d51d8a581
Fix #3547 : Fix duplicate key in PropertyAndEventBackingFieldLookup
7 months ago
Peter Crabtree
e1e16b64f5
dev: Strip BOM mark from text files
7 months ago
Daniel Grunwald
bd9ee28552
Fix #1789 : missing hyperlink for `MethodGroupResolveResult`.
8 months ago
Daniel Grunwald
587a359e8c
Fix #1873 : Clear ILRange in CopyPropagation
...
We are copying an expression from far away, reusing the ILRange would result in incorrect sequence points.
8 months ago
Daniel Grunwald
02d9dc3e85
Fix #3323 : Simplify cleanup in AwaitInFinallyTransform, ensuring that we do not miss any containers.
8 months ago
Daniel Grunwald
c84605a610
Fix #3468 : Try harder to avoid ref locals if `UseRefLocalsForAccurateOrderOfEvaluation` is not enabled.
...
CopyPropagation will replace `ref StructWithStringField reference = ref array[0];` with:
```
var x = array;
var y = 0;
```
and then every use of `reference` is replaced with `x[y]`.
This lets us avoid rough locals while preserving the semantics in every case except that we re-order when a NullReferenceException/IndexOutOfRangeException occurs.
8 months ago
Daniel Grunwald
ec58d57875
#3465 : Fix bugs in `comp.o` handling.
8 months ago
Daniel Grunwald
89083eaf48
Fix #3344 : Add support for the `ckfinite` opcode.
8 months ago
Daniel Grunwald
f826037acc
Protect IsInst against multi-step inlining -- we can only allow `Box` as the top-level argument, not anywhere within the argument tree.
8 months ago
Daniel Grunwald
8ad33f1e13
Fix #3479 : If YieldReturnDecompiler.ConvertBody fails, abort transforming the state machine instead of continuing with invalid code.
8 months ago
Daniel Grunwald
dd4bf7d8a4
Fix #3518 by replacing `FixLoneIsInst` with an inlining restriction.
...
This way we avoid having to extract later, as we will never inline if the `isinst` argument if this could result in it being unrepresentable in C#.
This commit also refactors inlining restrictions to avoid requiring special cases in ILInlining itself.
But when making this change, I discovered that this broke our pattern-matching tests, and that the weird IL with double `isinst` is indeed generated by the C# compiler for `if (genericParam is StringComparison.Ordinal)` style code. So instead we also allow `isinst` with a `box(expr-without-side-effects)` argument to be represented with the `expr is T ? (T)expr : null` emulation.
8 months ago
Jan Kučera
9d11f523b1
Always move initializer decompilation setting
8 months ago
ds5678
15223daabd
WIP preincrement improvements
8 months ago
Siegfried Pammer
6c00c138eb
Fix #3465 : Translate comp.o(a op b) if op not in (==, !=) into Unsafe.As<object, UIntPtr>(ref a) op Unsafe.As<object, UIntPtr>(ref b)
8 months ago
Christoph Wille
afcdcec146
Update for .NET 10 Preview 7 packages ( #3537 )
...
* Update NUnit (was: 4.3.2) to 4.4 and MTP (was: 1.7.3) to 1.8.1 (had to add VSTestBridge explicitly to override ref complaints by compiler)
* Update to .NET 10 Preview 7 NuGet packages
* Update dotnet-format
8 months ago
Christoph Wille
99165b7ce2
Update Humanizer ( #3532 )
8 months ago
Maximilian Schmöcker
43bfaba7e0
Add ExpandParamsArguments DecompilerSettings
8 months ago
Maximilian Schmöcker
850ffe593d
Fix methods with mandatory arguments ignore disabled OptionalArguments setting
8 months ago