C# PlatformNotSupportedException
Program.cs
Thread t = Thread.CurrentThread;
t.Name = "Main Thread";
t.Abort();
Output
kodingwindow@kw:~/csharp$ dotnet run
Unhandled exception. System.PlatformNotSupportedException: Thread abort is not supported on this platform.
    at System.Threading.Thread.Abort()
    at Program.<Main>$(String[] args) in /home/kodingwindow/csharp/Program.cs:line 3
kodingwindow@kw:~/csharp$ 
C# program to handle the PlatformNotSupportedException
Program.cs
try
{
    Thread t = Thread.CurrentThread;
    t.Abort();
}
catch(PlatformNotSupportedException)
{
    Console.WriteLine("Some part of your code doesn't supported on this platform");
}
Output
kodingwindow@kw:~/csharp$ dotnet run
Some part of your code doesn't supported on this platform
kodingwindow@kw:~/csharp$ 
What Next?
C# File Handling
Advertisement