"Can't add script behaviour AssemblyInfo.cs. The script needs to derive from MonoBehaviour!"

I tried adding the following script to an empty game object but I got the following error: “Can’t add script behaviour AssemblyInfo.cs. The script needs to derive from MonoBehaviour!”
Does anyone know what might cause this problem?
Thanks in advance!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LOCKANDUNLOCK : MonoBehaviour
{
        public bool GamePause = false;


    void Start()
    {
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
    }

    void Update()
    {
            if(Input.GetKeyDown(KeyCode.Escape))
            {
                if(GamePause)
                {
                   ResumeAndLock();
                }
                else
                {
                   PauseAndUnlock();  
                }
            }
    }

    void ResumeAndLock()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
        GamePause = false;
    }
    void PauseAndUnlock()
    {
       Cursor.lockState = CursorLockMode.None;
       Cursor.visible = true;
       GamePause = true;
    }

}

Any other compiler errors?

Also, the standard convention for naming classes is Pascal Case… so, for example, this class should be ‘LockAndUnlock’