Re: Code Access Security

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Richard Blewett [DevelopMentor] (richardb_at_develop.com)
Date: 10/07/04


To: microsoft.public.dotnet.framework
Date: Thu, 07 Oct 2004 13:42:53 -0700

The error message you are seeing looks like a Winforms default one - can you trap the exception nearer teh site that it happens (maybe where you show the other form (if you call ShowDialog on it) so we can have a look at the exception trace and see what is generating the SecurityException

 Regards

 Richard Blewett - DevelopMentor
 http://staff.develop.com/richardb/weblog

   nntp://news.microsoft.com/microsoft.public.dotnet.framework/<2A513F57-F7AF-46C6-809A-61473EB15832@microsoft.com>

 I see what you're saying Richard.
 No COM objects... that's the weird thing about this whole mess. The failing
 part of this app is just another form trying to load a grid with SQL data.
 All built in .NET, part of the same project.
 
 "Richard Blewett [DevelopMentor]" wrote:
 
> Hmm ... but you don't actually do any interop?
>
> Imports just saves you some typing it doesn't actually create a reference to any assemblies. The interop layer is contained in mscorlib which you will already be referencing. You don't need InteropServices to do strong naming - you need the reflection namespace for the AssemblyKeyFile attribute though.
>
> If you actually do any interop (use COM objects, have Declare statements, etc) then this would be the cause of your exception as the interop layer will issue a demand for a SecurityPermission for unmanaed code access. Partially trusted code doesn't get this permission by default and so you would get a SecurityException.
>
> Regards
>
> Richard Blewett - DevelopMentor
> http://staff.develop.com/richardb/weblog
>
> nntp://news.microsoft.com/microsoft.public.dotnet.framework/>
>
> I did type it in :)
> I do have a reference (Imports) to System.Runtime.InteropServices in
> AssemlyInfo.vb
> I only added that reference as I saw it in the help files from Microsoft
> regarding creating Strong Names for assemblies.
>
>
>
> "Richard Blewett [DevelopMentor]" wrote:
>
> > I'm assuming you typed that in rather than cut and paste it - -so do you mean it required the SecurityPermission?
> >
> > Does your code use interop?
> >
> > Regards
> >
> > Richard Blewett - DevelopMentor
> >
http://staff.develop.com/richardb/weblog
> >
>
>
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004

 
 [microsoft.public.dotnet.framework]



Relevant Pages

  • Re: When "ToString" does not equal "ToString"
    ... Regards ... Richard Blewett - DevelopMentor ... > The code that is failing is the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: registry HKEY_LOCAL_MACHINE and user rights
    ... Regards ... Richard Blewett - DevelopMentor ... since the Application.CommonAppDataRegistry puts information in a ... common user data from keys created for previous versions of the application? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Hi
    ... Regards ... Richard Blewett - DevelopMentor ... Checked by AVG anti-virus system. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Share common code
    ... If you build the MSI using VS.NET then yes, they wikll be part of the deployment package. ... Regards ... Richard Blewett - DevelopMentor ... > Incoming mail is certified Virus Free. ...
    (microsoft.public.dotnet.framework)
  • Re: very large object allocation
    ... Regards ... Richard Blewett - DevelopMentor ... > Incoming mail is certified Virus Free. ...
    (microsoft.public.dotnet.framework)