TheSwamp
Code Red => .NET => Topic started by: dousmell on July 30, 2008, 07:11:25 PM
-
I'm having some issues w/ VS2008 and AutoCAD:
• When I run code using VS2008 in debug works flawlessly.
• When NETLOAD module independently of VS2008 => Crash and burn. :(
Can someone please help?
internal class paletteSetLibrary
{
// {31258470-74A3-4b73-AF2F-EB5342684526}
private static Guid PaletteSetId = new Guid("31258470-74A3-4b73-AF2F-EB5342684526");
public PaletteSet paletteSet { get; set; }
public void Initialize()
{
paletteSet = new PaletteSet("Library", PaletteSetId)
{
Visible = true,
Style = PaletteSetStyles.Snappable | PaletteSetStyles.ShowAutoHideButton,
WindowState = FormWindowState.Normal,
KeepFocus = true
};
var libraryViewer = new LibraryViewer();
var elementHost = new ElementHost(){Dock = DockStyle.Fill};
elementHost.Child = libraryViewer;
paletteSet.Add("Details", elementHost);
}
}
-
I don't know, have you tried copying the referenced acad dll into the same folder as the dll you are loading?
Might be worth a shot.
-
Could this have something to do with the different versions of the .net runtime? Wpf is v3 and acad defaults to v2 doesn't it?
-
Make sure you have at least .net V2 with the service pack
-
Whether the references are "CopyLocal" or not I get this:
Application does not support just-in-time (JIT)
debugging. See the end of this message for details.
************** Exception Text **************
System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.Threading.DispatcherObject.VerifyAccess()
at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at System.Windows.Input.Keyboard.IsFocusable(DependencyObject element)
at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew)
at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
at System.Windows.UIElement.Focus()
at System.Windows.Forms.Integration.ElementHost.OnGotFocus(EventArgs e)
at System.Windows.Forms.Control.WmSetFocus(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Integration.ElementHost.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ActiveXImpl.System.Windows.Forms.IWindowTarget.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
acdbmgd
Assembly Version: 17.1.0.0
Win32 Version: 17.1.219.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AcdbMgd.DLL
----------------------------------------
msvcm80
Assembly Version: 8.0.50727.1434
Win32 Version: 8.00.50727.1434
CodeBase: file:///C:/Windows/WinSxS/x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.1434_none_d08b6002442c891f/msvcm80.dll
----------------------------------------
acmgd
Assembly Version: 17.1.0.0
Win32 Version: 17.1.51.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/acmgd.DLL
----------------------------------------
AecSpaceOffsetRulesManager
Assembly Version: 5.5.256.0
Win32 Version: 5, 5, 256, 0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AecSpaceOffsetRulesManager.DLL
----------------------------------------
AecSpaceOffsetStandardBasic
Assembly Version: 5.5.256.0
Win32 Version: 5.5.256.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AecSpaceOffsetStandardBasic.DLL
----------------------------------------
AecBaseMgd
Assembly Version: 5.5.256.0
Win32 Version: 5, 5, 256, 0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AecBaseMgd.DLL
----------------------------------------
AecSpaceOffsetStandardBasic.resources
Assembly Version: 5.5.235.0
Win32 Version: 5, 5, 235, 0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/en-US/AecSpaceOffsetStandardBasic.resources.DLL
----------------------------------------
AecArchMgd
Assembly Version: 5.5.256.0
Win32 Version: 5, 5, 256, 0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AecArchMgd.DLL
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
AecSpaceOffsetStandardBOMA
Assembly Version: 5.5.256.0
Win32 Version: 5.5.256.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/Space%20Calculation%20Standards/AecSpaceOffsetStandardBOMA.dll
----------------------------------------
AecSpaceOffsetStandardBOMA.resources
Assembly Version: 5.5.235.0
Win32 Version: 5, 5, 235, 0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/en-US/AecSpaceOffsetStandardBOMA.resources.DLL
----------------------------------------
AecSpaceOffsetStandardDIN
Assembly Version: 5.5.256.0
Win32 Version: 5.5.256.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/Space%20Calculation%20Standards/AecSpaceOffsetStandardDIN.dll
----------------------------------------
AecSpaceOffsetStandardDIN.resources
Assembly Version: 5.5.235.0
Win32 Version: 5, 5, 235, 0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/en-US/AecSpaceOffsetStandardDIN.resources.DLL
----------------------------------------
AecSpaceOffsetStandardSIS
Assembly Version: 5.5.256.0
Win32 Version: 5.5.256.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/Space%20Calculation%20Standards/AecSpaceOffsetStandardSIS.dll
----------------------------------------
AecSpaceOffsetStandardSIS.resources
Assembly Version: 5.5.235.0
Win32 Version: 5, 5, 235, 0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/en-US/AecSpaceOffsetStandardSIS.resources.DLL
----------------------------------------
AecDtlDb
Assembly Version: 5.5.256.0
Win32 Version: 5, 5, 256, 0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AecDtlDb.DLL
----------------------------------------
AecDtlDbUI
Assembly Version: 5.5.256.0
Win32 Version: 5.5.256.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AecDtlDbUI.DLL
----------------------------------------
AecDtlDbLib
Assembly Version: 5.5.256.0
Win32 Version: 5.5.256.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AecDtlDbLib.DLL
----------------------------------------
AcInfoCenterConn
Assembly Version: 17.1.0.0
Win32 Version: 17.1.51.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AcInfoCenterConn.DLL
----------------------------------------
AdInfoCenter
Assembly Version: 17.1.0.0
Win32 Version: 17.1.219.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AdInfoCenter.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Autodesk.Interop.AcInetEngine
Assembly Version: 17.1.51.0
Win32 Version: 17.1.51.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/Autodesk.Interop.AcInetEngine.DLL
----------------------------------------
AdInfoCenter.resources
Assembly Version: 17.1.0.0
Win32 Version: 17.1.51.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/en-US/AdInfoCenter.resources.DLL
----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
6fmce9vq
Assembly Version: 17.1.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Autodesk.Interop.WSCommCntr1
Assembly Version: 17.1.51.0
Win32 Version: 17.1.51.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/Autodesk.Interop.WSCommCntr1.DLL
----------------------------------------
Autodesk.Interop.WebServices1
Assembly Version: 17.1.51.0
Win32 Version: 17.1.51.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/Autodesk.Interop.WebServices1.DLL
----------------------------------------
System.Web.Services
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll
----------------------------------------
shwurmkx
Assembly Version: 17.1.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
BGA.CAD.Library
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/Administrator/Documents/Visual%20Studio%202008/Projects/BGA.CAD.Library/BGA.CAD.Library/bin/Debug/BGA.CAD.Library.dll
----------------------------------------
WindowsFormsIntegration
Assembly Version: 3.0.0.0
Win32 Version: 3.0.6920.1413 built by: SP1Beta1
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/WindowsFormsIntegration/3.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
----------------------------------------
PresentationFramework
Assembly Version: 3.0.0.0
Win32 Version: 3.0.6920.1413 built by: SP1Beta1
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/PresentationFramework/3.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
PresentationCore
Assembly Version: 3.0.0.0
Win32 Version: 3.0.6920.1413 built by: SP1Beta1
CodeBase: file:///C:/Windows/assembly/GAC_32/PresentationCore/3.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
WindowsBase
Assembly Version: 3.0.0.0
Win32 Version: 3.0.6920.1413 built by: SP1Beta1
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/WindowsBase/3.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
PresentationFramework.Classic
Assembly Version: 3.0.0.0
Win32 Version: 3.0.6920.1413 built by: SP1Beta1
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/PresentationFramework.Classic/3.0.0.0__31bf3856ad364e35/PresentationFramework.Classic.dll
----------------------------------------
UIAutomationProvider
Assembly Version: 3.0.0.0
Win32 Version: 3.0.6920.1413 built by: SP1Beta1
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/UIAutomationProvider/3.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll
----------------------------------------
UIAutomationTypes
Assembly Version: 3.0.0.0
Win32 Version: 3.0.6920.1413 built by: SP1Beta1
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/UIAutomationTypes/3.0.0.0__31bf3856ad364e35/UIAutomationTypes.dll
----------------------------------------
System.Runtime.Serialization
Assembly Version: 3.0.0.0
Win32 Version: 3.0.4506.2060 (SP1Beta1.030422-0100)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Serialization/3.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.ServiceModel
Assembly Version: 3.0.0.0
Win32 Version: 3.0.4506.2060 (SP1Beta1.030422-0100)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.ServiceModel/3.0.0.0__b77a5c561934e089/System.ServiceModel.dll
----------------------------------------
AcLayer
Assembly Version: 17.1.0.0
Win32 Version: 17.1.219.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AcLayer.DLL
----------------------------------------
AcMgdShared
Assembly Version: 17.1.0.0
Win32 Version: 17.1.51.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/AcMgdShared.DLL
----------------------------------------
acmgdinternal
Assembly Version: 17.1.0.0
Win32 Version: 17.1.219.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/acmgdinternal.DLL
----------------------------------------
AcLayer.resources
Assembly Version: 17.1.0.0
Win32 Version: 17.1.51.0
CodeBase: file:///C:/Program%20Files/AutoCAD%20Architecture%202008/en-US/AcLayer.resources.DLL
----------------------------------------
************** JIT Debugging **************
Application does not support Windows Forms just-in-time (JIT)
debugging. Contact the application author for more
information.
-
Also try sticking the assembly/assemblies in the acad folder
-
Now this may be a dumb question: If I already have .NET V3.5 do I still need to install V2.0? Also, why does the code run in DEBUG? I'm trying to bind to a web service using WPF which is really easy. But the code won't run in ACAD. I'm really glad you all are awake right now.
Thanks very much for your help.
P.S. Do you guys have these posts as RSS? I would love to read all this where ever I am.
-
I did try to isolate the problem by using an empty WPF usercontrol to see if it was due to the WPF Interop that was causing the problem. The problem does continue. I also tried an empty ElementHost control with no WPF associated with it and it does load fine. So I've narrowed it down to the interaction w/ WPF.
Does anyone know if there is a way I can get WPF to use the same thread as Acad? I also tried Thread.ApartmentState=ApartmentState.STA and no effect.
I'm guessing that somehow when the code is running in visual studio that VS has some configuration some where that makes WPF behave properly within ACAD but I have no clue to find out why that is. Or is it that Microsoft just makes Debug run code perfectly to mislead us on purpose?
-
I'm almost certain this is your problem:
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3031 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
WPF is a new feature of .NET 3.0. Try forcing .NET 3.5 or whatever in autocad's app.config (or whatever that file is called).
-
Scratch that thought, I see you have WPF loaded further down.
-
can you post a sample solution for us to try?
-
Hello all,
I've got my solution reduced to the essentials. I would be indebted to you all if you could have a go at this and give me your thoughts.
Thanks again,