.NET

.NET

Reply
Member
andreiim
Posts: 5
Registered: ‎03-25-2013
Message 1 of 8 (466 Views)

.NET Datepicker control throws e0434352h error when loaded in Autocad

466 Views, 7 Replies
06-23-2013 09:36 AM

I'm working on a VB.NET library for Autocad and I must show a dialog with a datepicker on it. It shows the window fine, but if I try to change the selected date it throws this error:

    FATAL ERROR: Unhandled e0434352h Exception at fd3b9e5dh

and obviously it exits. I've created a simple mock project to isolate the problem, here is the whole code:

Window1.xaml

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <DatePicker
            HorizontalAlignment="Left"
            VerticalAlignment="Top"/>
    </Grid>
</Window>

 
Window1.xaml.vb

Imports Autodesk.AutoCAD.Runtime

Public Class Window1
End Class

Public Class init
    Implements IExtensionApplication

    Public Sub Initialize() Implements IExtensionApplication.Initialize
        'This Code runs when the library is loaded in autocad
        '(through netload command for eg)
        Dim MainWindow = New Window1
        MainWindow.Show()
    End Sub

    Public Sub Terminate() Implements IExtensionApplication.Terminate
    End Sub

End Class

 
What is the most curious thing about this is that if I run autocad from Visual Studio, by clicking Start and then I load my library from this instance of Autocad, it works as expected and I can change the date, but it takes a lot more time for Autocad to load itself.

What does Visual Studio do to acad.exe that it makes it work as intended with Datepicker control?

I suppose it loads some additional libraries. Datepicker is part of PresentationFramework.dll and I tried to load it manually from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\PresentationFramework.dll , but it didn't help.

Or how can I debug such an error? What does e0434352h and fd3b9e5dh mean?

On every autodesk forum it says that this is a .NET related problem, and you should reinstall Autocad and .NET, but I already know this is a .NET problem, because I'm causing it from .NET. This solution obviously work for others, because a clean install would get read of crappy custom library, like the one above, but I want it to work.

In my original project I've already tried to bind the control to some datetime properties from my viewmodel, but to no help.

Windows 7 x64
Autocad Map 3d 64bit
Visual Studio 2012

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 2 of 8 (424 Views)

Re: .NET Datepicker control throws e0434352h error when loaded in Autocad

06-23-2013 05:47 PM in reply to: andreiim

You should avoid creating your WPF UI directly from IExtensionApplication.Initialize().

 

Instead, in your Initialize() method, add a handler to the Application's Idle event.

 

The first time the event fires, have the handler remove itself from the event so it doesn't fire again, and then create and show your UI.

Member
andreiim
Posts: 5
Registered: ‎03-25-2013
Message 3 of 8 (422 Views)

Re: .NET Datepicker control throws e0434352h error when loaded in Autocad

06-23-2013 05:51 PM in reply to: DiningPhilosopher
This is not my actual application, but only a simplified example project to prove the problem. It doesn't matter where I create the window, I have the same problem when I try to change the date in the datepicker.
ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 4 of 8 (376 Views)

Re: .NET Datepicker control throws e0434352h error when loaded in Autocad

06-26-2013 07:35 AM in reply to: andreiim

try this:

 

  1. enable this http://through-the-interface.typepad.com/through_the_interface/2011/06/public-symbols-for-autocad-20...
  2. Set a break point in your initialize
  3. Start your .NET project in the debugger with Enable Mixed Mode debugging turned on
  4. Once the break point is hit, switch to the debugger->Tools->Exceptions and turn them all on
  5. Run your code, break where the crash happens
  6. Copy the call stack and paste it here

 

 





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Member
andreiim
Posts: 5
Registered: ‎03-25-2013
Message 5 of 8 (365 Views)

Re: .NET Datepicker control throws e0434352h error when loaded in Autocad

06-26-2013 04:08 PM in reply to: fenton.webb

Thank you for your answer. I managed to avoid the problem by using another control(DateTimeUpDown from WPF extended toolkit, if anyone else has this problem) for the date picker, without a popup, but if I can find a solution for this, I'll go back to the nicer popup datepicker.

 

I enabled Autodesk's symbols. I never used anything else than VS2012, but Enable native code debugging seems to be the equivalent of mixed-mode debugging.

As I expected, and stated initially, there was no error throwed and everything worked as expected, because I started the project from Visual Studio. Only if I start acad.exe independently and then I load the library, it throws the error.

I tried to start acad.exe independently, then attach Visual Studio to it, but everything freezes.

 

Anyway, in the meantime, I learned a little bit about WinDBG. I tried to load the Autodesk symbols, but if I use symchk, it says mismatched or not found on lots of pdb's, which seems appropriate, since I use Autocad Map 3D 2013 and these symbols are for Autocad 2012(at least that's what the article says), but I think some of the symbols loaded anyway. If I start acad.exe independently and then attach Windbg to the process, or I open it in Windbg, I get the same behaviour(the error is thrown and it's the same error). Here are the results of k, !clrstack and !pe:

 

Spoiler
0:000> k
Child-SP          RetAddr           Call Site
00000000`0021d7e0 000007fe`dcf04e13 KERNELBASE!RaiseException+0x39
00000000`0021d8b0 000007fe`dcf0597e clr!RaiseTheExceptionInternalOnly+0x28b
00000000`0021d9a0 000007fe`d7bfbc7e clr!IL_Throw+0xe3
00000000`0021db40 000007fe`d768ebc2 PresentationFramework_ni+0x157bc7e
00000000`0021dc00 000007fe`d96d284d PresentationFramework_ni+0x100ebc2
00000000`0021dc80 000007fe`d6ad09e5 WindowsBase_ni+0x14284d
00000000`0021dd10 000007fe`d96d24ca PresentationFramework_ni+0x4509e5
00000000`0021e0f0 000007fe`d96cf2bc WindowsBase_ni+0x1424ca
00000000`0021e260 000007fe`d96ce29e WindowsBase_ni+0x13f2bc
00000000`0021e590 000007fe`d96d2e91 WindowsBase_ni+0x13e29e
00000000`0021e710 000007fe`d769b789 WindowsBase_ni+0x142e91
00000000`0021e780 000007fe`d8087c86 PresentationFramework_ni+0x101b789
00000000`0021e9b0 000007fe`d8087460 PresentationCore_ni+0x2c7c86
00000000`0021ea10 000007fe`d8541173 PresentationCore_ni+0x2c7460
00000000`0021ec40 000007fe`d8087c86 PresentationCore_ni+0x781173
00000000`0021ece0 000007fe`d8087460 PresentationCore_ni+0x2c7c86
00000000`0021ed40 000007fe`d8073e4e PresentationCore_ni+0x2c7460
00000000`0021ef70 000007fe`d8070224 PresentationCore_ni+0x2b3e4e
00000000`0021f000 000007fe`d809c901 PresentationCore_ni+0x2b0224
00000000`0021f060 000007fe`d80ababd PresentationCore_ni+0x2dc901
00000000`0021f100 000007fe`d80ab7c0 PresentationCore_ni+0x2ebabd
00000000`0021f150 000007fe`d8080b94 PresentationCore_ni+0x2eb7c0
00000000`0021f280 000007fe`d808077c PresentationCore_ni+0x2c0b94
00000000`0021f370 000007fe`d96e994a PresentationCore_ni+0x2c077c
00000000`0021f3e0 000007fe`d96e97d0 WindowsBase_ni+0x15994a
00000000`0021f490 000007fe`d96e95fe WindowsBase_ni+0x1597d0
00000000`0021f4e0 000007fe`d96e9587 WindowsBase_ni+0x1595fe
00000000`0021f540 000007fe`d96e692c WindowsBase_ni+0x159587
00000000`0021f5a0 000007fe`d96e8e60 WindowsBase_ni+0x15692c
00000000`0021f640 000007fe`d988e717 WindowsBase_ni+0x158e60
00000000`0021f740 000007fe`dcd8f2ee WindowsBase_ni+0x2fe717
00000000`0021f7d0 00000000`776b9bd1 clr!UMThunkStub+0x6e
00000000`0021f860 00000000`776b98da USER32!UserCallWinProcCheckWow+0x1ad
00000000`0021f920 00000000`79d550ca USER32!DispatchMessageWorker+0x3b5
00000000`0021f9a0 00000001`3f7a3d62 mfc100u!AfxInternalPumpMessage+0x52
00000000`0021f9d0 00000001`3f7a3d44 ACAD!CAcadApp::PumpMessageWithSEH+0x12
00000000`0021fa10 00000001`3f7a3bbd ACAD!CAcadApp::PumpMessage+0x14
00000000`0021fa40 000007fe`cec93b5c ACAD!CAcadApp::runMessageLoop+0x13d
00000000`0021faa0 000007fe`cec93bb3 accore!AcApAppImp::runMessageLoop+0x4c
00000000`0021fb00 00000001`3f7a4ca6 accore!AcApAppImp::run+0x33
00000000`0021fb30 00000000`79d87548 ACAD!CAcadApp::Run+0x66
00000000`0021fba0 00000001`3f7ce4ae mfc100u!AfxWinMain+0xac
00000000`0021fbe0 00000000`7759652d ACAD!std::basic_streambuf<char,std::char_traits<char> >::imbue+0x1d4
00000000`0021fc90 00000000`777cc521 kernel32!BaseThreadInitThunk+0xd
00000000`0021fcc0 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
0:000> !clrstack
OS Thread Id: 0x260c (0)
        Child SP               IP Call Site
000000000021da58 000007fefd639e5d [HelperMethodFrame: 000000000021da58]
000000000021db40 000007fed7bfbc7e System.Windows.Controls.SelectedDatesCollection.InsertItem(Int32, System.DateTime)
000000000021dc00 000007fed768ebc2 System.Windows.Controls.Calendar.OnSelectedDateChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
000000000021dc80 000007fed96d284d System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
000000000021dd10 000007fed6ad09e5 System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
000000000021e0f0 000007fed96d24ca System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
000000000021e260 000007fed96cf2bc System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
000000000021e590 000007fed96ce29e System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
000000000021e710 000007fed96d2e91 System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object)
000000000021e780 000007fed769b789 System.Windows.Controls.Primitives.CalendarItem.Cell_MouseLeftButtonDown(System.Object, System.Windows.Input.MouseButtonEventArgs)
000000000021e9b0 000007fed8087c86 System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
000000000021ea10 000007fed8087460 System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
000000000021ec40 000007fed8541173 System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
000000000021ece0 000007fed8087c86 System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
000000000021ed40 000007fed8087460 System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
000000000021ef70 000007fed8073e4e System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
000000000021f000 000007fed8070224 System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
000000000021f060 000007fed809c901 System.Windows.Input.InputManager.ProcessStagingArea()
000000000021f100 000007fed80ababd System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
000000000021f150 000007fed80ab7c0 System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
000000000021f280 000007fed8080b94 System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
000000000021f370 000007fed808077c System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
000000000021f3e0 000007fed96e994a MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
000000000021f490 000007fed96e97d0 MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
000000000021f4e0 000007fed96e95fe System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
000000000021f540 000007fed96e9587 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
000000000021f5a0 000007fed96e692c System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
000000000021f640 000007fed96e8e60 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
000000000021f740 000007fed988e717 DomainBoundILStubClass.IL_STUB_ReversePInvoke(Int64, Int32, Int64, Int64)
0:000> !pe
Exception object: 0000000016d41d18
Exception type:   System.NotSupportedException
Message:          This type of Collection does not support changes to its SourceCollection from a thread different from the Dispatcher thread.
InnerException:   <none>
StackTrace (generated):
    SP               IP               Function
    000000000021DB40 000007FED7BFBC7E PresentationFramework_ni!System.Windows.Controls.SelectedDatesCollection.InsertItem(Int32, System.DateTime)+0x563b7e
    000000000021DC00 000007FED768EBC2 PresentationFramework_ni!System.Windows.Controls.Calendar.OnSelectedDateChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)+0x1c2
    000000000021DC80 000007FED96D284D WindowsBase_ni!System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)+0xdd
    000000000021DD10 000007FED6AD09E5 PresentationFramework_ni!System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)+0x275
    000000000021E0F0 000007FED96D24CA WindowsBase_ni!System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)+0xfa
    000000000021E260 000007FED96CF2BC WindowsBase_ni!System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)+0x54c
    000000000021E590 000007FED96CE29E WindowsBase_ni!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)+0x31e
    000000000021E710 000007FED96D2E91 WindowsBase_ni!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object)+0xa1
    000000000021E780 000007FED769B789 PresentationFramework_ni!System.Windows.Controls.Primitives.CalendarItem.Cell_MouseLeftButtonDown(System.Object, System.Windows.Input.MouseButtonEventArgs)+0x5f9
    000000000021E9B0 000007FED8087C86 PresentationCore_ni!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)+0x56
    000000000021EA10 000007FED8087460 PresentationCore_ni!System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)+0x270
    000000000021EC40 000007FED8541173 PresentationCore_ni!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)+0x183
    000000000021ECE0 000007FED8087C86 PresentationCore_ni!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)+0x56
    000000000021ED40 000007FED8087460 PresentationCore_ni!System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)+0x270
    000000000021EF70 000007FED8073E4E PresentationCore_ni!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)+0x14e
    000000000021F000 000007FED8070224 PresentationCore_ni!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)+0x64
    000000000021F060 000007FED809C901 PresentationCore_ni!System.Windows.Input.InputManager.ProcessStagingArea()+0x431
    000000000021F100 000007FED80ABABD PresentationCore_ni!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)+0xfd
    000000000021F150 000007FED80AB7C0 PresentationCore_ni!System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)+0x410
    000000000021F280 000007FED8080B94 PresentationCore_ni!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)+0x334
    000000000021F370 000007FED808077C PresentationCore_ni!System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+0x7c
    000000000021F3E0 000007FED96E994A WindowsBase_ni!MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)+0x14a
    000000000021F490 000007FED96E97D0 WindowsBase_ni!MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)+0x80
    000000000021F4E0 000007FED96E95FE WindowsBase_ni!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)+0x5e
    000000000021F540 000007FED96E9587 WindowsBase_ni!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)+0x47
    000000000021F5A0 000007FED96E692C WindowsBase_ni!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)+0x2bc
    000000000021F640 000007FED96E8E60 WindowsBase_ni!MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)+0x140

StackTraceString: <none>
HResult: 80131515

I'm not the most qualified person to analyze this, but it seems to me, that the InsertItem and the dispatcher are on the same thread.

 

The main question is why this doesn't happend, when I start acad.exe from Visual Studio? I thought it's the exact same thing if I I start acad.exe or if Visual Studio starts it( as it's the same thing if I start acad.exe or Windbg starts it)

 

I also  tried to attach the example project, but it says that the file is corrupt. This is not important anyway, as the problem is very easy to recreate using only the code in the first post.

 

OFFTOPIC: The number of views of this topic is kind of misleading as it increases every time I refresh, even if I'm logged in. I don't know if this is a bug or by design, but, in my opinion, it would be better if the forum would follow the general rules on any forum for the number of views.

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 6 of 8 (341 Views)

Re: .NET Datepicker control throws e0434352h error when loaded in Autocad

06-27-2013 09:04 AM in reply to: andreiim

can you post a rebuildable sample project so we can take a look please?





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Member
andreiim
Posts: 5
Registered: ‎03-25-2013
Message 7 of 8 (321 Views)

Re: .NET Datepicker control throws e0434352h error when loaded in Autocad

06-27-2013 02:20 PM in reply to: fenton.webb

I think there's a problem with the attachments on this forum, here is a link to the project on my GDrive https://googledrive.com/host/0B2pQLsuhuBTMazd1STlTbnBLUFk/DatePickerMock.zip

Distinguished Contributor
Mikko
Posts: 212
Registered: ‎10-03-2003
Message 8 of 8 (315 Views)

Re: .NET Datepicker control throws e0434352h error when loaded in Autocad

06-27-2013 04:00 PM in reply to: andreiim

Been out of the game these past few years and don't get to play with AutoCAD much, but happened to read your post and thought I'd try that datepicker control myself as I've never had problems with it.  What I found more cumbersome was getting the wpf form to center itself in the AutoCAD document window.  Anyway, here is the code I used to check out the datepicker control along with how I centered it.  I'll download what you posted and take a look see at that also.  Here is the link http://todazereality.com/downloads/testingonly.zip where I put it as it looks as some things never change.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.