Re: Prevent DLL usage



"Pavel Minaev" <int19h@xxxxxxxxx> wrote in message news:8e051f55-4af9-433c-b571-accafc6f1c45@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 9, 12:33 am, Chris Zopers <test123tes...@xxxxxxxxx> wrote:
Aha, I didn't know the InternalsVisibleTo atribute yet, but I googled it
and it seems to do the trick too. Thanks!

Note that even for internal classes, there's nothing stopping a
FullTrust assembly from using reflection to instantiate your classes
and call their methods. FullTrust is precisely what the name implies -
no restrictions.

I'd neglected to consider instantiation through reflection. But even if that wasn't possible, there's always decompilers or patched runtimes to bypass security checks. The admin of the computer can always do anything.


Anyway, if all you want to achieve is to give a strong hint that your
assembly should not be used directly, then internal+InternalsVisibleTo
is probably the best way, since no-one can accidentally ignore that
(unlike CAS).

Know how the runtime penalty compares, between InternalsVisibleTo and CAS?

.



Relevant Pages

  • Re: Reflection, how to understand
    ... I'm trying understand jdk 5 reflection. ... Then it proceeds to get a constructor for said class, ... Then it proceeds to instantiate the object using said constructor, ... I use that code snippet for persistence of simple objects ...
    (comp.lang.java.programmer)
  • Re: Reflection
    ... Alternatively you can use Reflection, ... > constructor, how do i go about instantiating it. ... > but for some odd reason i never am able to instantiate my objects ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How do I create an object?
    ... I hope the new parametrized type feature of C# will also have reflection ... -- Jim Robertson ... >> Is there a way to instantiate an object whose type isn't known until ...
    (microsoft.public.dotnet.framework)
  • ReflectionOnlyLoad in Macro
    ... I am trying to do a reflection only load of an assembly, ... create new app domain ... instantiate class ...
    (microsoft.public.dotnet.languages.vb)
  • Re: FileNotFoundException
    ... class to instantiate from configuration and uses reflection to perform the ... misread the part about reflection. ... >> Adam Clauss ... >>> It turns out one of the libraries I use instantiates a class using ...
    (microsoft.public.dotnet.languages.csharp)

Quantcast