Hi:
I meet the problem a long time. currently the new Win10 update can't fix my problem. each time I run the following code the crash will coming and after that no document can be opened by microstation.
OS: win10 1803 newest update
VS2017 newest update
CE UP 10
this is the crashing screen shoot, and I think the following code made the crash. but no very sure, for each time I me the crash all the debug work will be stop, I do not have enough time to reinstall system and redebug.
IECSchema schema = FPAddin.FPSchema;//20180517修改为统一缓存的数据 if (schema == null) { FPUtility.ShowInformationMessage("装载FPSchema失败"); return; } //创建类 IECClass eCClass = schema.GetClass("Equipment"); if (eCClass == null) { FPUtility.ShowInformationMessage(String.Format("获取{0}类失败", "Equipment"), "当前支持的设备类型\nEquipment"); return; } //阻止为非图形类创建实例 if (!FPUtility.IsGraphicClass(eCClass)) { FPUtility.ShowInformationMessage(String.Format("无法为非图形类({0})创建实例", eCClass.Name)); return; } //创建类实现器 DgnECInstanceEnabler dgnECInstanceEnabler = DgnECManager.Manager.ObtainInstanceEnabler(Session.Instance.GetActiveDgnFile(), eCClass); if (dgnECInstanceEnabler == null) { FPUtility.ShowInformationMessage("获取Equipment类编辑器实例失败"); return; } //创建实例 IECInstance instance = eCClass.CreateInstance(); if (instance == null) { FPUtility.ShowInformationMessage("创建Equipment类实例失败"); return; } //创建的属性应该具有不同的GUID和创建、修改时间 instance["GUID"].StringValue = Guid.NewGuid().ToString(); instance["CreateTime"].StringValue = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); instance["ModifyTime"].StringValue = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); instance["Discipline"].StringValue = this.comboBox1.Text;//专业号 instance["Area"].StringValue = this.textBox7.Text.Trim();//区域号 instance["EUP_Type"].StringValue = this.textBox6.Text.Trim();//设备类型 instance["Number"].StringValue = this.textBox5.Text.Trim();//设备序号 instance["Description"].StringValue = this.textBox4.Text.Trim();//设备描述 instance["Specification"].StringValue = this.textBox1.Text.Trim();//型号规格 instance["Note"].StringValue = this.textBox3.Text.Trim();//备注 instance["Manufacturer"].StringValue = this.textBox2.Text.Trim();//供应商 List<Element> CanCreateElements = new List<Element>(); FPUtility.GetSelectedElements().ForEach(Ele => { if (CanCreateElements.Count > 0) return; if (Ele.DgnModel.IsReadOnly) { if (Ele.DgnModel.IsDgnAttachment) FPUtility.ShowInformationMessage(String.Format("实体位于参照模型上,无法进行设备属性创建")); else FPUtility.ShowInformationMessage(String.Format("无法为只读模型上的实体创建设备属性")); return; } var dgnECInstance = FPUtility.FindDgnECInstanceByElement(new List<Element>() { Ele }); if (dgnECInstance.Count > 0) { #if DEBUG //判断关联的元素是不是Equipment,没有关联Equipment的就可以关联 FPUtility.ShowInformationMessage(String.Format("元素:{0}(ID={1})已经关联了属性", Ele.ElementType.ToString(), Ele.ElementId)); #endif return; } CanCreateElements.Add(Ele); IDgnECInstance newInstance = dgnECInstanceEnabler.CreateInstanceOnElement(Ele, instance, false); if (newInstance != null) { FPUtility.ShowInformationMessage("创建设备成功", "属性创建成功:" + newInstance.InstanceId); } }); if (CanCreateElements.Count == 0) { FPUtility.ShowErrorMessage("选中的实体元素中没有符合创建设备的条件的元素"); } else { SelectionSetManager.EmptyAll(); SelectionSetManager.InvertElement(CanCreateElements[0], Session.Instance.GetActiveDgnModelRef()); }
tim316 said:OS: win10 1803 newest update
Check your Windows updates to ensure that the relevant update has been installed. I had to download that update manually and then install it. The next day, Windows asked me if I wanted to Restart the computer to finish installing that update.
Regards, Jon Summers LA Solutions
I definitely confirm that the update has been installed correctly. I am working now to try to get the bug.
Hi tim316,
Can you start Microsoft Visual Studio then Debug > Attach to Process: attaching to the running instance of MicroStation.exe (making sure Native is checked), then reproduce the issue? When you get the exception Debug > Save Dump As... Then Zip and Post via Secure Upload letting us know when it is available to review? I tried to lookup/disassemble the addresses in your call stack, but none of your addresses lined up for me and my MSCE U10 Commercial release (.23) build.
Bob
I have uploaded a dump. hope that can help you to find the bug. but i not sure it is uploaded correctly, if not please notice me to reload.
I seems got the bug's source. one of my form, if the form is not closed when MS application closing. will cause the crash. i add a code to close the opened forms, it seems working well now.