question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception on EnableReferences extension only when debugging

See original GitHub issue

I don’t know how to exactly reproduce it as it happens in specific circumstances. But when those are met, the exception always happens, eg. some of our tests always fail when debugging.

XmlSerializer is defined as follows:

private static readonly IExtendedXmlSerializer _Serializer = new ConfigurationContainer()
	.EnableReferences()
	.Create();

Full stacktrace:

DefaultActivators.Reference() in ExtendedXmlSerializer.ReflectionModel, ExtendedXmlSerializer.dll
DefaultActivators.Create() in ExtendedXmlSerializer.ReflectionModel, ExtendedXmlSerializer.dll
ConditionalWeakTable<Type, IActivator>.GetValue() in System.Runtime.CompilerServices, mscorlib.dll
ReferenceCacheBase<Type, IActivator>.Get() in ExtendedXmlSerializer.Core.Sources, ExtendedXmlSerializer.dll
FixedSource<Type, IActivator>.Get() in ExtendedXmlSerializer.Core.Sources, ExtendedXmlSerializer.dll
Lazy<IActivator>.CreateValue() in System, mscorlib.dll
Lazy<IActivator>.LazyInitValue() in System, mscorlib.dll
Lazy<IActivator>.get_Value() in System, mscorlib.dll
SingletonSource<IActivator>.Get() in ExtendedXmlSerializer.Core.Sources, ExtendedXmlSerializer.dll
Activators.Activator.Get() in ExtendedXmlSerializer.ExtensionModel.Types, ExtendedXmlSerializer.dll
Extensions.New<ExtendedXmlSerializer.ExtensionModel.RootInstanceExtension>() in ExtendedXmlSerializer.ReflectionModel, ExtendedXmlSerializer.dll
Extensions.New<ExtendedXmlSerializer.ExtensionModel.RootInstanceExtension>() in ExtendedXmlSerializer.ReflectionModel, ExtendedXmlSerializer.dll
Extensions.Add<ExtendedXmlSerializer.ExtensionModel.RootInstanceExtension>() in ExtendedXmlSerializer.Configuration, ExtendedXmlSerializer.dll
Extensions.Add<ExtendedXmlSerializer.ExtensionModel.RootInstanceExtension>() in ExtendedXmlSerializer.Configuration, ExtendedXmlSerializer.dll
Extensions.With<ExtendedXmlSerializer.ExtensionModel.RootInstanceExtension>() in ExtendedXmlSerializer.Configuration, ExtendedXmlSerializer.dll
Extensions.EnableRootInstances<ExtendedXmlSerializer.Configuration.IRootContext>() in ExtendedXmlSerializer.ExtensionModel, ExtendedXmlSerializer.dll
Extensions.EnableReferences() in ExtendedXmlSerializer.Configuration, ExtendedXmlSerializer.dll
Extensions.EnableReferences() in ExtendedXmlSerializer.Configuration, ExtendedXmlSerializer.dll
--- static xml serializer initialization is here
--- our test is here
[Native to Managed Transition]
RuntimeMethodInfo.UnsafeInvokeInternal() in System.Reflection, mscorlib.dll
RuntimeMethodInfo.Invoke() in System.Reflection, mscorlib.dll
MethodBase.Invoke() in System.Reflection, mscorlib.dll
TestMethodRunner.DefaultTestMethodInvoke() in Microsoft.VisualStudio.TestPlatform.MSTestFramework, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
TestMethodRunner.RunTestMethod() in Microsoft.VisualStudio.TestPlatform.MSTestFramework, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
TestMethodRunner.ExecuteTest() in Microsoft.VisualStudio.TestPlatform.MSTestFramework, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
TestMethodRunner.ExecuteInternal() in Microsoft.VisualStudio.TestPlatform.MSTestFramework, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
TestMethodRunner.Execute() in Microsoft.VisualStudio.TestPlatform.MSTestFramework, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
UnitTestRunner.RunInternal() in Microsoft.VisualStudio.TestPlatform.MSTestFramework, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
UnitTestRunner.RunSingleTest() in Microsoft.VisualStudio.TestPlatform.MSTestFramework, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
[Application Domain Transition]
MixedModeExecutor.ExecuteTestViaMsTestV1Runner() in Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
MixedModeExecutor.ExecuteTests() in Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
MixedModeExecutor.ExecuteDurontoTestsInternal() in Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
MixedModeExecutor.ExecuteDurontoTests() in Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
MixedModeExecutor.ExecuteTests() in Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
MixedModeExecutor.ExecuteTests() in Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
MixedModeExecutor.RunTests() in Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
MSTestExecutor.RunTests() in Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration, Microsoft.VisualStudio.TestPlatform.Extensions.VSTestIntegration.dll
TestExecutionManager.RunTestInternalWithExecutors() in Microsoft.VisualStudio.TestPlatform.Core, Microsoft.VisualStudio.TestPlatform.Core.dll
TestExecutionManager.RunTestsInternal() in Microsoft.VisualStudio.TestPlatform.Core, Microsoft.VisualStudio.TestPlatform.Core.dll
TestExecutionManager.RunTests() in Microsoft.VisualStudio.TestPlatform.Core, Microsoft.VisualStudio.TestPlatform.Core.dll
TestExecutionManager.RunTests() in Microsoft.VisualStudio.TestPlatform.Core, Microsoft.VisualStudio.TestPlatform.Core.dll
ThreadHelper.ThreadStart_Context() in System.Threading, mscorlib.dll
ExecutionContext.RunInternal() in System.Threading, mscorlib.dll
ExecutionContext.Run() in System.Threading, mscorlib.dll
ExecutionContext.Run() in System.Threading, mscorlib.dll
ThreadHelper.ThreadStart() in System.Threading, mscorlib.dll
[Native to Managed Transition]

Where the exception happens exactly: rider64_mvphh4donp

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bpaczkowskicommented, Dec 21, 2018

Seems ok, the exception is not thrown anymore for me.

0reactions
Mike-E-angelocommented, Dec 28, 2018

Ok cool. I have deployed this to nuget and it should be available soon. Please let us know if you encounter any additional issues and/or feel free to open a new issue as well. Closing for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable "just my code" setting in VSCode debugger?
Just adding "justMyCode": false to launch.json doesn't work. You need to add a separate config in launch.json like below.
Read more >
Visual Studio Debugger does not break on ...
In my output view I can see that a NullReferenceException is raised, my HTTP-REST-client receives "400 bad request", but the debugger ignores ...
Read more >
Cannot debug net6.0-macos Apps - Developer Community
Interesting point - in my VSfMac 17.4.2 I tried to disable “.Net Core Debugger” extension (Main menu (Visual Studio) - Extensions - Installed)....
Read more >
Manage exceptions with the debugger in Visual Studio
Learn how to specify which exceptions the debugger breaks on, at which point you want the debugger to break, and how breaks are...
Read more >
Debug ASP.NET Exceptions - Visual Studio (Windows)
To enable debugging of ASP.NET exceptions with Just My Code​​ On the Debug menu, click Windows > Exception settings. The Exceptions dialog box ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found