mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
The .NET 10 BCL ships static [Extension] classes that contain ordinary nested types (e.g. XDocumentExtensions.XDocumentNavigable). Decompiling such a nested type's member in isolation resolved the enclosing container's ExtensionInfo, and DecompileBody then dereferenced the missing extension-member mapping. A container without any extension blocks now reports no ExtensionInfo at all, and ResolveExtensionInfo applies a container's info only to members that actually belong to one of its extension blocks. Assisted-by: Claude:claude-fable-5:Claude Codepull/3943/head
5 changed files with 119 additions and 14 deletions
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.Decompiler.Tests.TestCases.IsolatedDecompilation |
||||
{ |
||||
// A static class whose only extension members use the classic "this" parameter syntax:
|
||||
// the type carries [Extension], but contains no C# 14 extension blocks.
|
||||
internal static class ClassicExtensions |
||||
{ |
||||
public static int Twice(this int x) |
||||
{ |
||||
return x * 2; |
||||
} |
||||
|
||||
private sealed class Nested |
||||
{ |
||||
public int Get() |
||||
{ |
||||
return 42; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// A static class that mixes a real C# 14 extension block with an ordinary nested type.
|
||||
internal static class BlockExtensions |
||||
{ |
||||
extension(List<int> list) |
||||
{ |
||||
public int DoubledCount => list.Count * 2; |
||||
} |
||||
|
||||
private sealed class Nested |
||||
{ |
||||
public int Get() |
||||
{ |
||||
return 42; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue