Application does not support just-in-time (JIT) error

I’ve only used Visual Studio to disable the JIT debugger, same with deleting registry entries.

So when I create a default Python script and execute it - it works fine. But as soon as I try to access Civil3D object it crashes.

for instance, i try to get an ObjectId of a input polyline


pline = IN[0]

adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor

out = []

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            # Place your code below
            # 
            #
            out.append(pline.ObjectId)
            # Commit before end transaction
            t.Commit()
            pass

# Assign your output to the OUT variable.
OUT = out

or this script also gives that error