GetAllAssetPaths : System.Security.SecurityException

I’m trying to write a 3DS Max plugin that can read a unity scene. I am new to Unity C# development (and somewhat new to C# development too)

when I attempt to use AssetDatabase.GetAllAssetPaths() in my VS project, it crashes due to a security exception. I have all added references for the .dlls In C:\Program Files (x86)\Unity\Editor\Data\Managed to my VS project.

my super simple program to output the results of GetAllAssetPaths() to the console:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
namespace UnitySceneReader
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] assets=  AssetDatabase.GetAllAssetPaths();
            Console.Write(assets);
            Console.ReadLine();
        }
    }
}

crashes with:

An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll

Additional information: ECall methods must be packaged into a system module.

can anybody clue me in on what I am doing wrong?

Um it looks like you are trying to use the Unity script environment OUTSIDE of Unity.

Why on earth would you imagine that this would work?