【CE UP10】 ucrtbase.dll crash

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());
                    }

Parents Reply Children
No Data