未经处理的异常: System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
为什么会存在这种后面还没运行到的代码可以影响前面代码的报错?
[STAThread]
static void Main(string[] args)
{
// 初始化
Init();
Product revitInstance = Product.GetInstalledProduct();
Console.WriteLine("1");
var clientId = new ClientApplicationId(Guid.NewGuid(), "testing", "ADSK.Username");
Console.WriteLine($"2, {clientId.GetGUID()}");
revitInstance.Init(clientId, "I am authorized by Autodesk to use this UI-less functionality.");
Console.WriteLine("3");
Autodesk.Revit.ApplicationServices.Application Application = revitInstance.Application;
Console.WriteLine("4");
Document Document = Application.OpenDocumentFile(inputPath);
Console.WriteLine("5");
UIDocument UIDocument = new UIDocument(Document);
Console.WriteLine("init finish");
......
}