简体   繁体   English

WPF应用程序在调试(发布/调试)模式之外失败

[英]WPF Application failing outside of Debug (release/debug) mode

Just to clarify, I have fixed this problem temperately and just wanted to see if someone could expand on why this happened and possibly give me some insight as to how to fix it permanently. 为了澄清起见,我已经温和地解决了这个问题,只想看看是否有人可以扩展此问题的发生原因,并可能给我一些有关如何永久解决此问题的见解。 I am building a plugin for AutoCAD and have ran into some troubles with some RadioButtons 我正在为AutoCAD构建插件,并且在使用某些RadioButton时遇到了一些麻烦

I set the GroupName property of my a group of RadioButtons so i could control them independently from a different group. 我设置了一组RadioButton的GroupName属性,以便可以从另一个组中独立控制它们。 Now when I'm debugging in either release and debug mode the application works, but when i netload my .dll into autocad to check how it performs outside of debug mode, I click one of the 8 radio buttons and autocad crashes (Im not worried about that) and i got the exception that it was throwing it is as follows: 现在,当我以发布和调试模式进行调试时,应用程序都可以运行,但是当我将.dll净加载到autocad中以检查其在调试模式之外的性能时,我单击了8个单选按钮之一,autocad崩溃了(我不担心关于这一点),我得到它抛出的异常如下:

the thread tried to read from or write to a virtual address for which it does not have the appropriate access

and part of the code that threw it: 和引发它的部分代码:

at System.Windows.Controls.RadioButton.UpdateRadioButtonGroup()
at System.Windows.Controls.RadioButton.OnChecked(RoutedEventArgs e)
at System.Windows.Controls.Primitives.ToggleButton.OnIsCheckedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)

Now i really don't understand why it is not working outside of debugging. 现在我真的不明白为什么它不能在调试之外工作。 Can someone please try to give me some insight to this? 有人可以尝试给我一些启示吗?

As a the temporary fix i removed GroupName from my RadioButton XAML. 作为临时修复,我从RadioButton XAML中删除了GroupName if you need any of the source please ask. 如果您需要任何来源,请询问。

I didn't get the issue fixed directly. 我没有直接解决问题。 But, as a work around, I put them in their own grid. 但是,作为解决方法,我将它们放在自己的网格中。 This gave me the results I was looking for. 这给了我想要的结果。

If you are showing your wpf view in a palette, try setting the session flag on the command to Session. 如果要在选项板中显示wpf视图,请尝试将命令上的会话标志设置为“会话”。

Example: 例:

CommandMethod("CommandName",CommandFlags.Session)] public void Something() { //Your code }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM