none
InternalsVisibleToAttribute RRS feed

  • Question

  • Hi

    I'm trying to modify a class in the System.dll assembly (HttpListenerResponse), without much luck so far. I found the InternalsVisibleToAttribute that should be capable of exposing the internals of System.dll to my application. So it went:

    - ildasm System.dll

    - add the InternalsVisibleToAttribute to it

    - ilasm it back to System.dll

    I was so happy to see all the internal classes and methods available in the VS ide, with code completion and everything. Until I tried to run it...

    By reassembling the il I lost the MS assigned strong name and replaced it with my own. No surprise all other assemblies started throwing exceptions. I then began to replace the dependent assemblies as well but got stuck on mscorlib.dll which is automatically referenced and although there's a /NoStdLib compiler option it's not available in the VS2012 ide.

    What's the recommended way to adapt a framework class (the method I need to replace is defined as internal and in a sealed class)?

    Thursday, September 19, 2013 1:24 PM

Answers

  • "Can I distribute applications with a custom CLR based on the MS sources?"

    You'd have to look at the licenses of those sources and ask a lawyer. But I'm pretty sure that the answer is "no".

    • Marked as answer by exstud Thursday, September 19, 2013 5:43 PM
    Thursday, September 19, 2013 5:28 PM
    Moderator

All replies

  • "What's the recommended way to adapt a framework class (the method I need to replace is defined as internal and in a sealed class)?"

    None. What you're asking is simply not supported.

    Thursday, September 19, 2013 2:10 PM
    Moderator
  • Would there be any legal issues in doing so? Can I distribute applications with a custom CLR based on the MS sources?
    Thursday, September 19, 2013 5:26 PM
  • "Can I distribute applications with a custom CLR based on the MS sources?"

    You'd have to look at the licenses of those sources and ask a lawyer. But I'm pretty sure that the answer is "no".

    • Marked as answer by exstud Thursday, September 19, 2013 5:43 PM
    Thursday, September 19, 2013 5:28 PM
    Moderator