Q:

The input data is not a complete block when trying to encrypt a key

I am trying to encrypt some key and its throwin 
The input data is not a complete block.  I tried some answers on stackoverflow but none of them seems to work! 
here's the code:
public static string Encrypt(string value)
        {
            string EncryptionKey = "THISISSOMEENCRYPTIONKEY";
            byte[] clearBytes = Encoding. UTF8.GetBytes(value);
            using (Aes encryptor = Aes. Create())
            {
                encryptor. BlockSize = 128;
                encryptor. Mode = CipherMode. ECB;
                encryptor. Padding = PaddingMode. None;

                Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });
                encryptor. Key = pdb. GetBytes(32);
                encryptor. IV = pdb. GetBytes(16);
                using (MemoryStream ms = new MemoryStream())
                {
                    using (CryptoStream cs = new CryptoStream(ms, encryptor. CreateEncryptor(), CryptoStreamMode. Write))
                    {
                        cs. Write(clearBytes, 0, clearBytes. Length);
                        cs. Close(); //the input data is not a complete block
                    }
                    value = Convert. ToBase64String(ms. ToArray());
                }
            }
            return value;
        }

p.s.  I have the same code on some of my old projects on ASP.NET Core 1.0 MVC and its working properly, and this one is .NET Core 2.2 (Library) API and its throwing me that error! 

A:

Have a look at following lines
Aes encryptor = Aes. Create()

encryptor. BlockSize = 128;
encryptor. Mode = CipherMode. ECB;
encryptor. Padding = PaddingMode. None;

AES cipher is a symmetric block cipher requiring that the input matches exactly the block size.  If the input length doesn't match the block size, the input is extended to required length using padding (usually PKCS#7 for symmetric cipher). 
In the code PaddingMode. None is specified, so the input length must match the block size. 
To encrypt longer input (multiplier of the block size), different modes of operation are used.  For your chosen parameters the input lenght needs to be multiple of the block size (16 bytes).  
Please note some modes are effectively creating a stream ciphers and don't require paddings (CFB, OFB, CTR)
Let's try:
encryptor. Mode = CipherMode. CBC;
encryptor. Padding = PaddingMode. PKCS7 

I have the same code on some of my old projects on ASP.NET Core 1.0 MVC and its working properly

Well - then we can only assume the input length is multiple of the block size 
Other security notes:

avoid ECB if possible (see the link for modes of operation)
other modes require unique IV (CBC mode requires unpredictable/random IV).  Deriving (the same) key and IV for multiple inputs is really not safe

