Author Topic: ADS request error  (Read 8438 times)

0 Members and 1 Guest are viewing this topic.

NickMerchant

  • Guest
ADS request error
« on: October 25, 2010, 06:04:33 PM »
Can anyone tell me why I'm getting this error?

I'm in the process of converting my AutoCAD/LDD/Civil 3D 3rd party Visual Lisp application (That I've been marketing since 2002) to C#.NET. I'm developing and integrating assemblies that gradually replace the functionality in each of about 100+ vlx files that are distributed and loaded to make the application run.

One of the vlx's contained a dialog for browsing for folders to use for storing program design & production data. I designed a very nice, dramatically improved dialog with C#.net that replaced the old version. I developed it using Visual Studio 2008 on a Windows XP computer. I tested it on two computers located in two different cities and setup by different people. AutoCAD 2009 and 2010 were both used for testing on Windows XP.

Today, I sent the updated version of the application to a client using Windows 7 and I was told that the application crashes now when trying to select a data path!






First, here is the portion of the Program.cs source that calls the dialog:
-------------------------------------------------------------------------


using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Text;
//
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;

namespace AseLandDataPathManager
{
   
    public class Class1
    {
        public static Editor acEditor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

        //****************************************

        //[CommandMethod("AsePath")]
        [LispFunction("AsePath")]
        public ResultBuffer ASEDataPath(ResultBuffer args)
        {

            ResultBuffer rbfResult = default( ResultBuffer );
            Form DataPathForm = new DataPath();
            Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(DataPathForm);
            rbfResult = new ResultBuffer( new TypedValue( (int)LispDataType.Text, DataPath.m_strCurrentPath ) );
            return rbfResult;
        }

        //****************************************









Here's the error that occurs when the command is invoked:
------------------------------------------------------------

Command: _DESIGN_DATA_PATH_SET
ASE: Dictionary initialized.
layer
Current layer:  "0"
Enter an option
[?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck
/Unlock/stAte/Description/rEconcile]: unlock
Enter name list of layer(s) to unlock or <select objects>: * Enter an option
[?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck
/Unlock/stAte/Description/rEconcile]:
Command: 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 AseLandDataPathManager.Class1.ASEDataPath(ResultBuffer args)
   at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object
commandObject, Boolean bLispFunction)
   at
Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo
 mi, Object commandObject, Boolean bLispFunction)
   at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi,
Boolean bLispFunction)
   at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.InvokeLisp()
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:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>
 
The demand was for:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>
 
The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.EnvironmentPermission,
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Read="USERNAME"/>
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Read="I:\ASE-SOFTWARE\"
PathDiscovery="I:\ASE-SOFTWARE\"/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission,
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="AssemblyIsolationByUser"
UserQuota="9223372036854775807"
Expiry="9223372036854775807"
Permanent="True"/>
<IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="ReflectionEmit"/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Assertion, Execution, BindingRedirects"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission,
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Url="file:///I:/ASE-SOFTWARE/AseLandDataPathManager.dll"/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission,
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Zone="Intranet"/>
<IPermission class="System.Net.DnsPermission, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="DefaultPrinting"/>
</PermissionSet>
The assembly or AppDomain that failed was:
AseLandDataPathManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The method that caused the failure was:
Autodesk.AutoCAD.DatabaseServices.ResultBuffer
ASEDataPath(Autodesk.AutoCAD.DatabaseServices.ResultBuffer)
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///I:/ASE-SOFTWARE/AseLandDataPathManager.dll; error: ADS request error

Jeff H

  • Needs a day job
  • Posts: 6150
Re: ADS request error
« Reply #1 on: October 25, 2010, 06:08:50 PM »
Ask him if the dll is on his hard drive or network.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: ADS request error
« Reply #2 on: October 25, 2010, 06:11:16 PM »
Also it looks like he does not have permission to do anything is he logged in as a guest

NickMerchant

  • Guest
Re: ADS request error
« Reply #3 on: October 25, 2010, 06:16:01 PM »
I can tell you that the DLL is on a network drive. This network version of the application is installed on a network drive, then each computer that uses it, loads the .vlx's and .dll's from the network drive where the installation is located.

I suspected that there was a read/write issue, but he said that he was logged in to his computer and access rights weren't an issue. maybe I should double-check, you think?

Jeff H

  • Needs a day job
  • Posts: 6150
Re: ADS request error
« Reply #4 on: October 25, 2010, 06:22:01 PM »
If the dll is on network then you need to give the folder the dll is in the correct rights and settings. You can use capsol. I tried to help someone one time with capsol and failed miserably you can google it.

Ask him to try it with the dll on his hard drive then it should work.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: ADS request error
« Reply #5 on: October 25, 2010, 06:27:40 PM »
CASPOL not CAPSOL

NickMerchant

  • Guest
Re: ADS request error
« Reply #6 on: October 25, 2010, 06:49:36 PM »
Jeff,

Thank you VERY much for you assistance!

-Nick Merchant

Glenn R

  • Guest
Re: ADS request error
« Reply #7 on: October 26, 2010, 03:57:36 PM »
There's a built-in folder browser dialog, as well as a file selection dialog...why aren't you using those?

NickMerchant

  • Guest
Re: ADS request error
« Reply #8 on: October 26, 2010, 04:39:12 PM »
I DO use them! However, AFTER the folder/path is selected (Using Windows' dialog) there are other processes specific to my application that user's have requested that are not part of the Windows folder selection dialog.

For example, my dialog will add the selected path to a history list of previously-selected paths in a drop-down list for ease of selection. Usually there are a number of drawings that will require the same path that was already browsed for. The drop-down allows the user to select it without having to browse repeatedly. There is also a control on the form that lets the user determine the length of the history list in the drop-down.

In addition to registry-stored information specific to the form properties, there are other features specific to my application that make this form attractive to my clients. However, I still invoke the Windows file selection dialog to browse for new paths at the user's request.

Believe me, I would never waste time "reinventing the wheel".

NickMerchant

  • Guest
Re: ADS request error
« Reply #9 on: October 26, 2010, 04:51:51 PM »
Glenn,

Excuse me, but I'm new to "The Swamp" and unfamiliar with you. I'm not trying to stir things up. I'm just curious though, because I don't know; is your profile image meant to insult my post or am I misinterpreting the purpose of the caption below it?

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: ADS request error
« Reply #10 on: October 26, 2010, 05:28:33 PM »
thats just his general saying, not directed at you
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: ADS request error
« Reply #11 on: October 26, 2010, 10:23:23 PM »

Actually, it's directed at me ... but I just ignore him  :-P
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: ADS request error
« Reply #12 on: October 26, 2010, 10:26:08 PM »
Kerry lies, anyone who has seen my attempts to pen C# understands.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Jeff H

  • Needs a day job
  • Posts: 6150
Re: ADS request error
« Reply #13 on: October 26, 2010, 10:30:40 PM »
 
I am the idiot who steered him the wrong direction
I will take the honors, and besides if I do understand what it means is that an automatic gimme?

NickMerchant

  • Guest
Re: ADS request error
« Reply #14 on: October 26, 2010, 10:39:58 PM »
Jeff,

Actually, you and CmdrDuh totally steered me in the right direction and solved my problem. I didn't realize that loading assemblies from a network location created a security issue in Windows. I modified the installation so that the .DLL's are installed locally, then I modified the source code so the .DLL's are loaded from the local installation folder. Now, "Its all good!"

The Swamp resident's are AWESOME! I've yet to search for solutions to C# & Visual Lisp problems and not find them here.

Thank you All!