I have
but when I then look at e.g. the decompiled source for any referenced class in the .NET framework e.g. System.Console or for Microsoft.AspNetCore.Builder (or almost any other type), all I can see for every method's body is throw null (I showed an extract below)
I have read this question (update: and the answer to the question it was a duplicate to), but there only one class had this problem (because it was added in an incremental update). For me, this problem applies to every class in the .NET framework. What am I doing wrong? Is this expected behaviour and I should use something like dotPeek? Can I use a symbols server instead of decompiled sources? (Forgive my ignorance, I'm really new to C#... and the .NET world)
region Assembly System.Console, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\System.Console.dll
// Decompiled with ICSharpCode.Decompiler 4.0.0.4521
#endregion
using System.IO;
using System.Text;
namespace System
{
// Summary:
// ....
public static ConsoleColor BackgroundColor
{
get
{
throw null;
}
set
{
}
}
//
// Summary:
//...
public static int BufferHeight
{
get
{
throw null;
}
set
{
}
}
...
Have you tried it with ILSpy?
You can use it standalone (free version here: https://github.com/icsharpcode/ILSpy), but If you have LinqPad, then ILSpy is included (I think in the paid version).
Try it the following way:
Create a sample program with 1 line you like to inspect:
void Main()
{
System.Console.Clear();
}
With the mouse pointer, set the cursor on "Clear()" and then press F12.
ILSpy opens showing the method you set the cursor on:
// System.Console
public static void Clear()
{
ConsolePal.Clear();
}
On the left side you can drill down into further into decompiled classes, e.g.
internal static class ConsolePal
{
[Flags]
internal enum ControlKeyState
{
RightAltPressed = 0x1,
LeftAltPressed = 0x2,
RightCtrlPressed = 0x4,
LeftCtrlPressed = 0x8,
ShiftPressed = 0x10,
NumLockOn = 0x20,
ScrollLockOn = 0x40,
CapsLockOn = 0x80,
EnhancedKey = 0x100
}
private sealed class WindowsConsoleStream : ConsoleStream
{
private readonly bool _isPipe;
private IntPtr _handle;
// ...
NOTE: As an alternative to LinqPad, Visual Studio 2022 ships also with decompilation support for F12 enabled by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With