.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Atraeus
1014 Views, 7 Replies

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

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

7 REPLIES 7
Message 2 of 8
Atraeus
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)

Message 3 of 8
BlackBox_
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



"How we think determines what we do, and what we do determines what we get."

Message 4 of 8
Atraeus
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.

Message 5 of 8
BlackBox_
in reply to: Atraeus

Thanks for posting your solution, for others to find.

 

Cheers



"How we think determines what we do, and what we do determines what we get."

Message 6 of 8
Atraeus
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

Message 7 of 8
BlackBox_
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



"How we think determines what we do, and what we do determines what we get."

Message 8 of 8
daniel.balogh
in reply to: Atraeus

Had the same issue with my WPF-Window... Radiobutton-change only switched the page in my window, so definitely no ACAD-Operations (ACA 2014, VS2010, net 4)
Removing Groupnames saved my day! I would have never-ever come for it 😄
Note: this only happens, if the WPF-Window is modeless, if modal, everything runs fine 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost