my apology, i've been on different threads researching this and forgot that I haven't even described the problem yet.
I get this error whenever a modal form is about to load. So in my code, which for the testing purpose is very very simple, works right up until the form is about to be loaded. Then I get this "unhandled exception error" and the details are:
Application does not support just-in-time (JIT)
debugging. See the end of this message for details.
************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Drawing.Icon.FromHandle(IntPtr handle)
at Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(IWin32Window owner, Form formToShow, Boolean persistSizeAndPosition)
at Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(Form formToShow)
at VbMgd1.ModalForm.ShowModalForm()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The first permission that failed was:
version="1"
Flags="UnmanagedCode"/>
The demand was for:
version="1"
Flags="UnmanagedCode"/>
The granted set of the failing assembly was:
version="1">
version="1"
Read="USERNAME"/>
version="1"
Unrestricted="true"/>
version="1"
Read="J:\Shared Data\AutoCad Support\LISP\"
PathDiscovery="J:\Shared Data\AutoCad Support\LISP\"/>
version="1"
Allowed="AssemblyIsolationByUser"
UserQuota="9223372036854775807"
Expiry="9223372036854775807"
Permanent="True"/>
version="1"
Flags="ReflectionEmit"/>
version="1"
Flags="Assertion, Execution, BindingRedirects"/>
version="1"
Unrestricted="true"/>
version="1"
Url="file:///J:/Shared Data/AutoCad Support/LISP/test5.dll"/>
version="1"
Zone="Intranet"/>
version="1"
Unrestricted="true"/>
version="1"
Level="DefaultPrinting"/>
The assembly or AppDomain that failed was:
test5, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The method that caused the failure was:
Void ShowModalForm()
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///J:/Shared Data/AutoCad Support/LISP/test5.dll
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at AcMgCommandClass.InvokeWorker(AcMgCommandClass* , MethodInfo mi, Object commandObject, Boolean bLispFunction)
at AcMgPerDocumentCommandClass.Invoke(AcMgPerDocumentCommandClass* , gcroot<:REFLECTION::METHODINFO>* mi, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.TargetInvocationSEHExceptionFilter.InvokeWorker()
at Autodesk.AutoCAD.Runtime.ExceptionFilter.Invoke()
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
acdbmgd
Assembly Version: 17.0.116.0
Win32 Version: 17.0.116.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcdbMgd.DLL
----------------------------------------
msvcm80
Assembly Version: 8.0.50727.1433
Win32 Version: 8.00.50727.1433
CodeBase: file:///C:/WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2/msvcm80.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
ResourceManagement
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/ResourceManagement.DLL
----------------------------------------
acmgd
Assembly Version: 17.0.116.0
Win32 Version: 17.0.116.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/acmgd.DLL
----------------------------------------
Redland.NET
Assembly Version: 1.0.2.1
Win32 Version: 1.0.2.1
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/Redland.NET.DLL
----------------------------------------
StyleUIStarter
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/StyleUIStarter.DLL
----------------------------------------
Autodesk.Spatial.Studio.UI
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/Autodesk.Spatial.Studio.UI.DLL
----------------------------------------
AcMapMdfModelMgd
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapMdfModelMgd.DLL
----------------------------------------
AcDxUi
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcDxUi.DLL
----------------------------------------
AcDx
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcDx.DLL
----------------------------------------
AcDxUi.resources
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/en-US/AcDxUi.resources.DLL
----------------------------------------
AcMgdShared
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMgdShared.DLL
----------------------------------------
AcLayer
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcLayer.DLL
----------------------------------------
AcLayer.resources
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/en-US/AcLayer.resources.DLL
----------------------------------------
AcMapDataConnectUi
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapDataConnectUi.DLL
----------------------------------------
AcMapDataConnectTools
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapDataConnectTools.DLL
----------------------------------------
AcMapDataConnectPlugins
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapDataConnectPlugins.DLL
----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
AcMapDataGridUI
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapDataGridUI.DLL
----------------------------------------
test5
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///J:/Shared%20Data/AutoCad%20Support/LISP/test5.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
TypeViewer
Assembly Version: 1.0.3140.32268
Win32 Version: 1.0.3140.32268
CodeBase: file:///C:/Documents%20and%20Settings/p13802/My%20Documents/TypeViewerSource/bin/Release/TypeViewer.dll
----------------------------------------
************** JIT Debugging **************
Application does not support Windows Forms just-in-time (JIT)
debugging. Contact the application author for more
information.
---------------------------------------------------------------------------
I have also tried one of sample projects from "through the interface" blog and get the same effect. So it is not my code.
If someone has a simple built dll that has a modal form and works for them, could they send it to me so I can test it if works on my machine?
Thanks,
Viktor.