Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File handles not cleaned up when ModuleDefinition.ReadSymbols throws #582

Closed
mrvoorhe opened this issue May 29, 2019 · 1 comment
Closed

Comments

@mrvoorhe
Copy link
Contributor

I was writing tests for monolinker using the new DeterministicMvid option and different types of symbol files and ran into an unexpected throw (that will be a separate bug). After the throw the next test failed with a file access exception. So something is not being cleaned up. The throw I hit was SymbolsNotMatchingException in

		public void ReadSymbols (ISymbolReader reader, bool throwIfSymbolsAreNotMaching)
		{
			if (reader == null)
				throw new ArgumentNullException ("reader");

			symbol_reader = reader;

			if (!symbol_reader.ProcessDebugHeader (GetDebugHeader ())) {
				symbol_reader = null;

				if (throwIfSymbolsAreNotMaching)
					throw new SymbolsNotMatchingException ("Symbols were found but are not matching the assembly");

				return;
			}

			if (HasImage && ReadingMode == ReadingMode.Immediate) {
				var immediate_reader = new ImmediateModuleReader (Image);
				immediate_reader.ReadSymbols (this);
			}
		}

My call stack was

ModuleDefinition.ReadSymbols() in Mono.Cecil, Mono.Cecil.dll
ModuleReader.ReadSymbols() in Mono.Cecil, Mono.Cecil.dll
ModuleReader.CreateModule() in Mono.Cecil, Mono.Cecil.dll
ModuleDefinition.ReadModule() in Mono.Cecil, Mono.Cecil.dll [2]
ModuleDefinition.ReadModule() in Mono.Cecil, Mono.Cecil.dll [1]
BaseAssemblyResolver.GetAssembly() in Mono.Cecil, Mono.Cecil.dll
BaseAssemblyResolver.SearchDirectory() in Mono.Cecil, Mono.Cecil.dll
BaseAssemblyResolver.Resolve() in Mono.Cecil, Mono.Cecil.dll
TestCaseAssemblyResolver.Resolve() in Mono.Linker.Tests.TestCasesRunner, Mono.Linker.Tests.dll
ResultChecker.ResolveLinkedAssembly() in Mono.Linker.Tests.TestCasesRunner, Mono.Linker.Tests.dll
ResultChecker.VerifyKeptSymbols() in Mono.Linker.Tests.TestCasesRunner, Mono.Linker.Tests.dll
ResultChecker.PerformOutputSymbolChecks() in Mono.Linker.Tests.TestCasesRunner, Mono.Linker.Tests.dll
ResultChecker.Check() in Mono.Linker.Tests.TestCasesRunner, Mono.Linker.Tests.dll
All.Run() in Mono.Linker.Tests.TestCases, Mono.Linker.Tests.dll
All.CommandLineTests() in Mono.Linker.Tests.TestCases, Mono.Linker.Tests.dll
[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
Reflect.InvokeMethod() in NUnit.Framework.Internal, nunit.framework.dll
MethodWrapper.Invoke() in NUnit.Framework.Internal, nunit.framework.dll
TestMethodCommand.RunNonAsyncTestMethod() in NUnit.Framework.Internal.Commands, nunit.framework.dll
TestMethodCommand.RunTestMethod() in NUnit.Framework.Internal.Commands, nunit.framework.dll
TestMethodCommand.Execute() in NUnit.Framework.Internal.Commands, nunit.framework.dll
TestActionCommand.Execute() in NUnit.Framework.Internal.Commands, nunit.framework.dll
SetUpTearDownCommand.Execute() in NUnit.Framework.Internal.Commands, nunit.framework.dll
SimpleWorkItem.PerformWork() in NUnit.Framework.Internal.Execution, nunit.framework.dll
WorkItem.RunTest() in NUnit.Framework.Internal.Execution, nunit.framework.dll [3]
WorkItem.Execute() in NUnit.Framework.Internal.Execution, nunit.framework.dll [3]
ParallelWorkItemDispatcher.Execute() in NUnit.Framework.Internal.Execution, nunit.framework.dll [2]
ParallelWorkItemDispatcher.Dispatch() in NUnit.Framework.Internal.Execution, nunit.framework.dll [2]
CompositeWorkItem.RunChildren() in NUnit.Framework.Internal.Execution, nunit.framework.dll [2]
CompositeWorkItem.PerformWork() in NUnit.Framework.Internal.Execution, nunit.framework.dll [2]
WorkItem.RunTest() in NUnit.Framework.Internal.Execution, nunit.framework.dll [2]
WorkItem.Execute() in NUnit.Framework.Internal.Execution, nunit.framework.dll [2]
ParallelWorkItemDispatcher.Execute() in NUnit.Framework.Internal.Execution, nunit.framework.dll [1]
ParallelWorkItemDispatcher.Dispatch() in NUnit.Framework.Internal.Execution, nunit.framework.dll [1]
CompositeWorkItem.RunChildren() in NUnit.Framework.Internal.Execution, nunit.framework.dll [1]
CompositeWorkItem.PerformWork() in NUnit.Framework.Internal.Execution, nunit.framework.dll [1]
WorkItem.RunTest() in NUnit.Framework.Internal.Execution, nunit.framework.dll [1]
WorkItem.Execute() in NUnit.Framework.Internal.Execution, nunit.framework.dll [1]
TestWorker.TestWorkerThreadProc() in NUnit.Framework.Internal.Execution, nunit.framework.dll
ThreadHelper.ThreadStart_Context() in System.Threading, mscorlib.dll
ExecutionContext.RunInternal() in System.Threading, mscorlib.dll
ExecutionContext.Run() in System.Threading, mscorlib.dll [2]
ExecutionContext.Run() in System.Threading, mscorlib.dll [1]
ThreadHelper.ThreadStart() in System.Threading, mscorlib.dll
[Native to Managed Transition]
[Application Domain Transition]
[Native to Managed Transition]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants