2

I am getting a "LoadFromContext Occurred" exception when I try to debug test cases in Visual Studio 2015. This is being done through the test explorer window and by right clicking on a test method and selecting "Debug Selected Tests." The exception is :

LoadFromContext occurred
Message: Managed Debugging Assistant 'LoadFromContext' has detected a problem in 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\x64\te.processhost.managed.exe'.
Additional information: The assembly named 'Wex.Logger.Interop' was loaded from 'file:///C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO 14.0/COMMON7/IDE/COMMONEXTENSIONS/MICROSOFT/TESTWINDOW/Wex.Logger.Interop.DLL' using the LoadFrom context. The use of this context can result in unexpected behavior for serialization, casting and dependency resolution. In almost all cases, it is recommended that the LoadFrom context be avoided. This can be done by installing assemblies in the Global Assembly Cache or in the ApplicationBase directory and using Assembly.Load when explicitly loading assemblies.

I tried following the instructions on the answer here, but disabling the UI Debugging Tools for XAML does not seem to affect things.

'Wex.Logger.Interop' is not an assembly I seen under my project references and is not something I import or load in my code. If I run my test cases normally, they will run without throwing this exception. It only occurs when I try debugging the test methods. I can run my test cases through the test explorer, they finish as expected. If I build and run my solution, it runs. If I debug my project, that doesn't cause an exception. But if I try debugging any of my test methods, it throws the LoadFromContext Occured exception.

Community
  • 1
  • 1
Sean
  • 83
  • 1
  • 7
  • When you say `debugging the test cases` are you trying to debug when running the test or did you debug it without being under the control of a testing application? If you are trying to debug when running the test then I would suggest that you create a separate program to run just the part you are trying to debug. – Guy Coder Apr 20 '16 at 15:13
  • Way I was debugging is via the test explorer window. Right click on a test and select "Debug Selected Tests" versus "Run Selected Tests." I realized this issue when created a specific test method for an error I found in my project so could just check that. Any of my tests I run, will run and pass or fail as expected. The project itself can be run regularly or in debug mode without this issue popping up. This exception is only occurring when I try to debug a Test Method. – Sean Apr 20 '16 at 16:45
  • You should edit the question and say that so that others will know. Not everyone reads comments. – Guy Coder Apr 20 '16 at 16:59
  • Okay, edited my question to contain more information. Let me know if there is anything else I should edit or add to it. – Sean Apr 20 '16 at 19:57

1 Answers1

0

Have you got "Break On All Errors" turned on, if so, turn off that error, its a .NET error and can be ignored. I had that error, I disabled the error and it worked fine. On the error popup that appears, there's a 'Break when this error occurs' or such like check box, just untick it.

MiscellaneousUser
  • 2,915
  • 4
  • 25
  • 44