Strong name failed when casting RRS feed

  • Question

  • Hi, I have simple example (extracted from more complex app, which is illustrating the need, not the purpose of the code)

    The code fails when I cast in the 3rd file from IInter to impl.impl, but obviously it should not. Can you please fix or explain me what is wrong? 



    Tuesday, March 31, 2020 3:16 PM

All replies

  • Hello,

    Rather than drop box show the relevant code and specify the line failing to cast. Then when you need at anytime to upload code using a .zip file use Microsoft OneDrive, setup an account with the same email address used here. 

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Tuesday, March 31, 2020 5:45 PM
  • when you had included the exception message in your post, we wouldn't have to download your code,
    adjust the hardcoded pathes (why do you do this?)
    and try to get it running.
    As the exception message explains: the types are in two different LoadContexts:
     cannot be cast to ...  in the context 'LoadNeither' the context 'Default' 

    This has been asked before.
    "Cannot cast object of type 'x' to 'x'"
    (btw: The blog posts by Suzanne Cook have since been moved to Suzanne Cook's .NET CLR Notes)

    a better explanation is in:
    InvalidCastException when using Assembly.LoadFile

    And I hope you do not want to reinvent the wheel by writing your own plugin architecture.

    Tuesday, March 31, 2020 5:55 PM
  • Hi PavelPrague,
    I viewed a same case in this forum and it has been solved. So has your problem been solved?
    Best Regards,
    Daniel Zhang

    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

    Wednesday, April 1, 2020 6:31 AM