ℹ️ Instructions for https://twitter.com/premun_/status/1626560566469791746
- Create a Codespace from https://github.com/dotnet/dotnet
- Change the
NullReferenceException.cs
file
code /workspaces/dotnet/src/runtime/src/libraries/System.Private.CoreLib/src/System/NullReferenceException.cs
- Build the .NET SDK (~45 minutes)
cd /workspaces/dotnet && ./prep.sh && ./build.sh --online
- Unpack the SDK
mkdir /workspaces/.dotnet && tar -zxf artifacts/x64/Release/dotnet-sdk-* -C /workspaces/.dotnet
- Create a new project:
mkdir /workspaces/foo && cd /workspaces/foo && /workspaces/.dotnet/dotnet new console
- Change
Program.cs
to throw an NRE
code Program.cs
You can put something likeConsole.WriteLine(((string?)null)!.Length);
- Run it
/workspaces/.dotnet/dotnet run
🔥🔥🔥
- Run the container:
docker run --rm -itv vmr:/vmr -w /vmr mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-36
- Clone the monorepo
git clone https://github.com/dotnet/dotnet .
- Change the
NullReferenceException.cs
file
vi /vmr/src/runtime/src/libraries/System.Private.CoreLib/src/System/NullReferenceException.cs
- Build the .NET SDK
./prep.sh && ./build.sh --online --clean-while-building
- Unpack the SDK
mkdir -p $HOME/.dotnet && tar -zxf artifacts/x64/Release/dotnet-sdk-* -C $HOME/.dotnet
- Create a new project:
mkdir $HOME/foo && cd $HOME/foo && $HOME/.dotnet/dotnet new console
- Change
Program.cs
to throw an NRE
echo 'Console.WriteLine(((string?)null)!.Length);' > Program.cs
- Run it
$HOME/.dotnet/dotnet run
🔥🔥🔥