.NET

.NET

Reply
Active Member
Atraeus
Posts: 7
Registered: ‎07-02-2012
Message 1 of 7 (341 Views)
Accepted Solution

Incurring a fatal error while while running WPF plugin - But not while debugging

341 Views, 6 Replies
11-18-2013 05:18 AM

Good morning, All

 

    I am incurring a fatal error while i am running a plugin i have developed in .NET. I am using AutoCAD 2012 and .NET 4.0. Where the fatal error occurs is when i am filtering a list for specific colors and specific linetypes to populate a listbox with. I did a quite a bit of reading and the only thing i have found is ( in debug compiler is giving a little more memory space for said collection and when i run it in outside of debug it is not. )  Now i dont really understand how to fix this issue or can verify that it really is the issue. is there some type of setting i can change inside of autocad for debugging so it doesn't completely shut down? i need to atleast try to find out exactly why it is failing and what i can do to fix it. 

 

I tried to upload a zip of my project bt it is to large, I will be more than happy to attach the files that i am able to.

 

Thanks in advance..

 

Trae

The issue was with WPF, I set the GroupName in XAML for a few radio buttons. Apparently it didn't like that. So by removing the GroupName the problem has been fixed.

Active Member
Atraeus
Posts: 7
Registered: ‎07-02-2012
Message 2 of 7 (324 Views)

Re: Incurring a fatal error while while running WPF plugin - But not while debug

11-18-2013 06:53 AM in reply to: Atraeus
To add, I have found the error data when autocad crashed and it as follows:

Clr Data:
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)

at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)

at System.Windows.DependencyObject.SetCurrentValueInternal(DependencyProperty dp, Object value)

at System.Windows.Controls.Primitives.ToggleButton.OnClick()

at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)

at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)

at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)

at System.Windows.Input.InputManager.ProcessStagingArea()

at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)

at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)

at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

Distinguished Mentor
BlackBox_
Posts: 785
Registered: ‎02-25-2013
Message 3 of 7 (312 Views)

Re: Incurring a fatal error while while running WPF plugin - But not while debug

11-18-2013 08:32 AM in reply to: Atraeus

Atraeus wrote:

i need to atleast try to find out exactly why it is failing and what i can do to fix it. 

 

I tried to upload a zip of my project bt it is to large, I will be more than happy to attach the files that i am able to.


Hi Trae,

 

If you're not already doing so, add a Try/Catch block to your code... Example:

 

void FOO()
{
     Document doc = Application.DocumentManager.MdiActiveDocument;
     Editor ed = doc.Editor;

     try
     {
          //<-- your code here
     }
     catch (System.Exception ex)
     {
          ed.WriteMessage("\n; error: {0}\n", ex.Message);
     }
}

 

Also, you can always post your code directly in your post, using the 'Insert Code' button (next to the Paste from Word button).

 

Cheers



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security


AutoCAD® 2014, and Civil 3D® 2014 Certified Professional ~ Autodesk® Authorized Developer

Active Member
Atraeus
Posts: 7
Registered: ‎07-02-2012
Message 4 of 7 (306 Views)

Re: Incurring a fatal error while while running WPF plugin - But not while debug

11-18-2013 08:45 AM in reply to: Atraeus

The issue was with WPF, I set the GroupName in XAML for a few radio buttons. Apparently it didn't like that. So by removing the GroupName the problem has been fixed.

Distinguished Mentor
BlackBox_
Posts: 785
Registered: ‎02-25-2013
Message 5 of 7 (300 Views)

Re: Incurring a fatal error while while running WPF plugin - But not while debug

11-18-2013 09:09 AM in reply to: Atraeus

Thanks for posting your solution, for others to find.

 

Cheers



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security


AutoCAD® 2014, and Civil 3D® 2014 Certified Professional ~ Autodesk® Authorized Developer

Active Member
Atraeus
Posts: 7
Registered: ‎07-02-2012
Message 6 of 7 (299 Views)

Re: Incurring a fatal error while while running WPF plugin - But not while debug

11-18-2013 09:09 AM in reply to: BlackBox_

BlackBox,

 

    I did implement a few try/catch statments, But the error would close autocad and not give me any feed back... I don't know why the GroupName property inside my XAML was making it fail like that.. I guess it reads from a different thread. Im not very clear on that. I am going to post the question to StackOverflow and see if i can get an answer.

 

Thanks for your help though.

 

Trae

Distinguished Mentor
BlackBox_
Posts: 785
Registered: ‎02-25-2013
Message 7 of 7 (291 Views)

Re: Incurring a fatal error while while running WPF plugin - But not while debug

11-18-2013 09:34 AM in reply to: Atraeus

Atraeus wrote:

BlackBox,

 

    I did implement a few try/catch statments, But the error would close autocad and not give me any feed back... 


Try adding a break point at your call to ed.WriteMessage()... Stepping through should also be something to consider when debugging.

 

Cheers



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security


AutoCAD® 2014, and Civil 3D® 2014 Certified Professional ~ Autodesk® Authorized Developer

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.