CS0250 – Do not directly call your base class Finalize method. It is called automatically from your destructor

C# Compiler Error

CS0250 – Do not directly call your base class Finalize method. It is called automatically from your destructor

Reason for the Error

You’ll receive this error in your C# program when you attempt to call the Finalize method of the base class.

For example, lets try to compile the below code snippet.

namespace DeveloperPubNamespace
{
    public class BaseEmployee
    {

    }
    public class Employee : BaseEmployee
    {
        ~Employee()
        {
            // This will result with error code CS0250
            base.Finalize();
        }
    }
    class Program
    {
        public static void Main()
        {

        }
    }
}

You will receive the error code CS0250 in your C# program because we are explicitly calling the Finalize method of the base class from the destructor of the Employee class.

Error CS0250 Do not directly call your base type Finalize method. It is called automatically from your destructor. DeveloperPublish C:\Users\SenthilBalu\source\repos\ConsoleApp3\ConsoleApp3\Program.cs 12 Active

CS0250 – Do not directly call your base class Finalize method. It is called automatically from your destructor

Solution

C# Compiler doesnot allow you to force cleanup of the base class resources.