An attempt to open DLL RRS feed

  • Question

  • I am attempting to write a method to open up a dll and get all the information out of it (Reflection). The code I am posting is very raw and I am not sure I understand what I am doing but I solicit suggestions. The code does not compile and the errors are in the last statement, really the two arguments, info and context. The message is that there are two unassigned local variables. How can I make them assigned? What values shall I give them?

    public static void OpenDll (string fileName)
                Assembly myDLLAssembly = Assembly.LoadFile(fileName);
                Module[] mods = myDLLAssembly.GetModules(true);
                Object ka = myDLLAssembly.GetCustomAttributesData();
                Evidence asEvidence = myDLLAssembly.Evidence;
                Type attributeType = (Type)ka;
                ka = myDLLAssembly.GetCustomAttributes();
                Module[] mods2 = myDLLAssembly.GetLoadedModules(true);
                SerializationInfo info;
                StreamingContext context;
                myDLLAssembly.GetObjectData(info, context);

    Thanks, - MyCatAlex

    Tuesday, July 17, 2018 12:39 AM

All replies

  • ISerializable Interface that is at the center of it all is described here but I cannot find a way to reference it. Need help. Thanks.
    Tuesday, July 17, 2018 12:50 AM
  • Hi MyCatAlex,

    Thank you for posting here.

    Based on my test, the complier error caused by that you use unassigned local variables info, context.

    Try the examples in the MSDN document.


    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 24, 2018 6:39 AM
  • Hi Wendy,

    I've seen the sample and was thinking about trying it. Cannot do now, very busy with other parts of my project but in a few days will try it and then I'll mark your post as answer.

    Thank you, - MyCatAlex

    • Edited by MyCatAlex Wednesday, July 25, 2018 6:55 PM
    Wednesday, July 25, 2018 6:54 PM