Siegfried Pammer
a537dad7ef
Fix #3774 : keep field initializers when decompiling a static ctor alone
...
The "IL with C#" view decompiles each method body as a bare handle, so a
static constructor is decompiled without its type's field declarations in
the syntax tree. MoveFieldInitializersToDeclarations then could not find a
declaration to move the static-field-initializer statement onto, asserted
(kind was Static, not Primary) and dropped the statement -- crashing Debug
builds and silently losing the assignment in Release.
Dropping the statement is only correct for the primary-constructor case,
where the assignment's backing member is synthesized and has no separate
declaration. For static/instance initializers a missing declaration just
means the member is not part of this partial syntax tree, so the
assignment must remain in the constructor body.
Assisted-by: Claude:claude-opus-4-8:Claude Code
3 months ago
Siegfried Pammer
79b0cbb719
Fix #3703 : Do not transform to a primary constructor if it's not public (or protected in abstract classes)
5 months ago
Siegfried Pammer
3a27cbef06
Fix #3617 : Order of XML comments in types with primary constructors
9 months ago
mmusu3
88b2c437a7
Address PR review feedback
10 months ago
mmusu3
22ceb6e7d1
Fix remaining cases with changes to IntroduceUsingDeclarations.
10 months ago
Siegfried Pammer
94050a4aca
Rewrite TransformFieldAndConstructorInitializers from a step-by-step AST-based analysis to an analysis that tracks the whole constructor body.
10 months ago
Siegfried Pammer
7a5a2a00a9
#3452 : Transform field initializers in structs only if no record and no primary ctor.
10 months ago
Siegfried Pammer
cb48768b6d
Fix #3610 : Add more primary constructor test cases.
10 months ago
Siegfried Pammer
46c99f1a21
Fix #3452 : More bugs with primary constructors.
10 months ago
Siegfried Pammer
9c8d1e48d9
Many thanks to @sonyps5201314 for providing the test cases and a suggested fix, which inspired these changes.
...
Various improvements regarding primary constructor decompilation, including:
- introduce `HasPrimaryConstructor` property in the AST, as there is a difference between no primary constructor and a parameterless primary constructor
- improved support for inherited records and forwarded ctor calls
- exclude non-public fields and properties in IsPrintedMember
- introduce an option to always make the decompiler emit primary constructors, when possible
10 months ago
sonyps5201314
b63b515a27
Exclude `System.Runtime.CompilerServices.RefSafetyRulesAttribute` from the `module` attribute in the generated `AssemblyInfo.cs`, because including it causes the compiler error: `error CS8335: Do not use 'System.Runtime.CompilerServices.RefSafetyRulesAttribute'. This is reserved for compiler usage.`. ( #3606 )
10 months ago
Siegfried Pammer
c075f7b9c8
Fix out var for expressions appearing in a lambda and not in a statement.
11 months ago
Siegfried Pammer
d11c40719d
#3569 : Don't move out variable declarations out of lambdas.
11 months ago
ds5678
c54318173b
Fix lower case type name conflicting with variable name
12 months ago
Peter Crabtree
e1e16b64f5
dev: Strip BOM mark from text files
1 year ago
Jan Kučera
9d11f523b1
Always move initializer decompilation setting
1 year ago
Siegfried Pammer
9dde97414a
Rename ResolvedUsingScope to UsingScope
1 year ago
Siegfried Pammer
c9e3790adc
Remove UnresolvedUsingScope
1 year ago
Siegfried Pammer
d2d9281072
Move CanTransformToExtensionMethodCall to CSharpResolver
1 year ago
Siegfried Pammer
e56f12cf93
Fix #2165 : DeclareVariables step must update ResolveResult annotation when using out var.
1 year ago
Siegfried Pammer
ddb7171a2a
Fix #3524 : Property without backing field cannot have an initializer.
1 year ago
Siegfried Pammer
49368caf1c
Rename option to "UseObjectCreationOfGenericTypeParameter"
1 year ago
DoctorKrolic
47eeacd7aa
Add an option to not transform `Activator.CreateInstance<T>()` to `new T()`
1 year ago
Siegfried Pammer
2fb90b49e0
Adjust string.Concat handling in ReplaceMethodCallsWithOperators to support unexpanded string.Concat calls.
1 year ago
ds5678
586c04d081
Support params keyword on non-array collections
1 year ago
Siegfried Pammer
978c31ca5e
Add PropertyAndEventBackingFieldLookup to improve performance of MemberIsHidden.
1 year ago
ds5678
361bb17618
Add configuration option to check for overflow and underflow
1 year ago
Siegfried Pammer
453fc06e02
Fix #3406 : Wrong decompilation of record struct without primary constructor.
1 year ago
Siegfried Pammer
0481c7d1ee
Improve LINQ decompiler to support combining lambda parameter names if they syntactically refer to the same range variable
2 years ago
Siegfried Pammer
fa50e8d8b3
Add non-embedded attributes to all tests that use older framework versions.
2 years ago
Siegfried Pammer
c478ccc2e0
Fix #3319 : KeyDownEvent field reference was replaced with KeyDown event reference.
2 years ago
Siegfried Pammer
e96605ca87
Fix #3310 : Filter out copy-constructor only if it's an actual record type.
2 years ago
Siegfried Pammer
2043e5dd6f
Add support for C# 12 primary constructors.
2 years ago
Siegfried Pammer
fd1de09489
Avoid using operator + for string concatenation when ref-like types are involved.
2 years ago
Siegfried Pammer
9d22e3ab41
NullableLiftingTransform: Undo new compiler optimization (omitting get_HasValue for comparisions with constants)
2 years ago
Siegfried Pammer
02d2a8c1f8
Add metadata processing for C# 12 'ref readonly' parameters
2 years ago
Siegfried Pammer
4bf9487ecd
Remove IsRef, IsOut and IsIn flags from IParameter and Replace ParameterModifiers with ReferenceKind.
2 years ago
Daniel Grunwald
d48df11133
Remove unused transforms: DecimalConstantTransform and ParameterNullCheckTransform
2 years ago
Siegfried Pammer
6c08851cb0
#3209 : Only add imports for extension methods.
2 years ago
Siegfried Pammer
972354913e
Fix #3209 : Ensure using directives are added for extension methods in higher level patterns such as: foreach -> GetEnumerator(), collection initializer -> Add() and deconstruction -> Deconstruct().
2 years ago
Siegfried Pammer
ca78d4a14d
Use MetadataFile instead of PEFile in TypeSystem.
3 years ago
Siegfried Pammer
ee160b4e2a
#3075 : Improve performance of CSharpResolver.LookupSimpleNameOrTypeName in cases with a large number of local variables.
3 years ago
Kirill Osenkov
7992d148e8
Generate sequence points for expression-bodied properties and indexers
3 years ago
Siegfried Pammer
13227e433e
Fix compound assignments with local variables.
3 years ago
Daniel Grunwald
b80d20b15d
Add support for calling `operator checked`.
3 years ago
Daniel Grunwald
8b9ba20847
Builtin unsigned right shift operator.
3 years ago
Daniel Grunwald
3c46271a11
Add support for unsigned right shift.
...
Only for user-defined operators so far; builtin right shifts still cast to the appropriate type.
3 years ago
Daniel Grunwald
9359d47c0b
Add support for ScopedRefAttribute
3 years ago
Siegfried Pammer
539925f259
Fix #2983 : display-class locals should be named uniquely per top-level ILFunction. Add assertion to ResolveCollisions: ensure that colliding/merged variables have the same type.
3 years ago
ElektroKill
a5febb3e4f
Add support for VB.NET automatic events
4 years ago