{"action":"created","issue":{"url":"https://api.github.com/repos/nunit/nunit3-vs-adapter/issues/296","repository_url":"https://api.github.com/repos/nunit/nunit3-vs-adapter","labels_url":"https://api.github.com/repos/nunit/nunit3-vs-adapter/issues/296/labels{/name}","comments_url":"https://api.github.com/repos/nunit/nunit3-vs-adapter/issues/296/comments","events_url":"https://api.github.com/repos/nunit/nunit3-vs-adapter/issues/296/events","html_url":"https://github.com/nunit/nunit3-vs-adapter/issues/296","id":200815085,"number":296,"title":"Mono.Cecil causes OutOfMemoryException with new .csproj PDBs","user":{"login":"jnm2","id":8040367,"avatar_url":"https://avatars2.githubusercontent.com/u/8040367?v=4","gravatar_id":"","url":"https://api.github.com/users/jnm2","html_url":"https://github.com/jnm2","followers_url":"https://api.github.com/users/jnm2/followers","following_url":"https://api.github.com/users/jnm2/following{/other_user}","gists_url":"https://api.github.com/users/jnm2/gists{/gist_id}","starred_url":"https://api.github.com/users/jnm2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnm2/subscriptions","organizations_url":"https://api.github.com/users/jnm2/orgs","repos_url":"https://api.github.com/users/jnm2/repos","events_url":"https://api.github.com/users/jnm2/events{/privacy}","received_events_url":"https://api.github.com/users/jnm2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jnm2","id":8040367,"avatar_url":"https://avatars2.githubusercontent.com/u/8040367?v=4","gravatar_id":"","url":"https://api.github.com/users/jnm2","html_url":"https://github.com/jnm2","followers_url":"https://api.github.com/users/jnm2/followers","following_url":"https://api.github.com/users/jnm2/following{/other_user}","gists_url":"https://api.github.com/users/jnm2/gists{/gist_id}","starred_url":"https://api.github.com/users/jnm2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnm2/subscriptions","organizations_url":"https://api.github.com/users/jnm2/orgs","repos_url":"https://api.github.com/users/jnm2/repos","events_url":"https://api.github.com/users/jnm2/events{/privacy}","received_events_url":"https://api.github.com/users/jnm2/received_events","type":"User","site_admin":false},"assignees":[{"login":"jnm2","id":8040367,"avatar_url":"https://avatars2.githubusercontent.com/u/8040367?v=4","gravatar_id":"","url":"https://api.github.com/users/jnm2","html_url":"https://github.com/jnm2","followers_url":"https://api.github.com/users/jnm2/followers","following_url":"https://api.github.com/users/jnm2/following{/other_user}","gists_url":"https://api.github.com/users/jnm2/gists{/gist_id}","starred_url":"https://api.github.com/users/jnm2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnm2/subscriptions","organizations_url":"https://api.github.com/users/jnm2/orgs","repos_url":"https://api.github.com/users/jnm2/repos","events_url":"https://api.github.com/users/jnm2/events{/privacy}","received_events_url":"https://api.github.com/users/jnm2/received_events","type":"User","site_admin":false}],"milestone":null,"comments":62,"created_at":"2017-01-14T16:50:03Z","updated_at":"2018-02-14T21:41:43Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I converted the old-style test .csproj targeting .NET Framework 4.6.2 to a new-style .csproj targeting the exact same .NET Framework 4.6.2 (VS2017 build 15.0.26020.0):\r\n\r\n```xml\r\n<Project Sdk=\"Microsoft.NET.Sdk\" ToolsVersion=\"15.0\">\r\n  <PropertyGroup>\r\n    <TargetFramework>net462</TargetFramework>\r\n    <RuntimeIdentifier>win</RuntimeIdentifier>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"**\\*.cs\" />\r\n    <EmbeddedResource Include=\"**\\*.resx\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <PackageReference Include=\"NUnit\" Version=\"3.6.0\" />\r\n  </ItemGroup>\r\n</Project>\r\n```\r\n\r\nAll tests run exactly the same as they always have using the NUnit console runner, but no tests are discovered using the NUnit VS adapter. I found out why- Mono.Cecil is causing OutOfMemoryExceptions while reading the PDB to find source code locations:\r\n\r\n```\r\n   at Microsoft.Cci.Pdb.MsfDirectory..ctor(PdbReader reader, PdbFileHeader head, BitAccess bits)\r\n   at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, Dictionary`2& tokenToSourceMapping, String& sourceServerData, Int32& age, Guid& guid)\r\n   at Mono.Cecil.Pdb.PdbReader.PopulateFunctions()\r\n   at Mono.Cecil.Pdb.PdbReader.ProcessDebugHeader(ImageDebugDirectory directory, Byte[] header)\r\n   at Mono.Cecil.ModuleDefinition.ProcessDebugHeader()\r\n   at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader)\r\n   at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters)\r\n   at Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters)\r\n   at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)\r\n   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)\r\n   at NUnit.VisualStudio.TestAdapter.NavigationDataProvider.CacheTypes(String assemblyPath)\r\n   at NUnit.VisualStudio.TestAdapter.NavigationDataProvider.GetNavigationData(String className, String methodName)\r\n   at NUnit.VisualStudio.TestAdapter.TestConverter.MakeTestCaseFromXmlNode(XmlNode testNode)\r\n   at NUnit.VisualStudio.TestAdapter.TestConverter.ConvertTestCase(XmlNode testNode)\r\n   at NUnit.VisualStudio.TestAdapter.NUnit3TestDiscoverer.ProcessTestCases(XmlNode topNode, ITestCaseDiscoverySink discoverySink, TestConverter testConverter\r\n```\r\n\r\nI want to stress that **this is not related to .NET Core**. The new PDB format will be used in the future for all normal .NET projects including .NET Framework projects.\r\n\r\nThe relevant Mono.Cecil PDB issue is at https://github.com/jbevain/cecil/issues/282.\r\nSupport for this new PDB format is shipped so far only in [0.10-beta1](https://github.com/jbevain/cecil/releases/tag/0.10-beta1) and [0.10-beta2](https://github.com/jbevain/cecil/releases/tag/0.10-beta2).\r\n\r\nAll we need is the source file and line number. I read through https://github.com/nunit/nunit3-vs-adapter/issues/183, but I'm concerned that Mono.Cecil might not be the best way to go. It's never going to be as reliable as, say, Roslyn. [xUnit's desktop VS test adapter](https://github.com/xunit/visualstudio.xunit/blob/master/xunit.runner.visualstudio.desktop/xunit.runner.visualstudio.desktop.csproj) also does not use Mono.Cecil.\r\n\r\nCan we use Visual Studio to give us the source file and line number for a given assembly and type or member? That's going to be the most reliable since it's the IDE itself that will be doing the navigating.\r\nIf not, can we use Roslyn?\r\n\r\nHow close can we get to where this is all happening, so that ideally we don't end up chasing a moving target? It's [comments like this](https://github.com/nunit/nunit3-vs-adapter/blob/master/src/NUnitTestAdapter/NavigationDataProvider.cs#L56-L60) that make me worry that we're reinventing the wheel somewhere:\r\n\r\n```c#\r\n// Through NUnit 3.2.1, the class name provided by NUnit is\r\n// the reflected class - that is, the class of the fixture\r\n// that is being run. To use for location data, we actually\r\n// need the class where the method is defined.\r\n// TODO: Once NUnit is changed, try to simplify this.\r\n```\r\n\r\nWouldn't it be better to hand Visual Studio an assembly path, a class name and a method and have Visual Studio or at least Roslyn do the work of figuring out what file and line number the method is defined in? I mean imagine when they add the Source Generators proposal. I'd rather offload this to VS and Roslyn since they are ultimately responsible to know all this stuff.\r\nOtherwise we'll always be playing catch-up with new language and debugging features and crash, like we're doing right now?"},"comment":{"url":"https://api.github.com/repos/nunit/nunit3-vs-adapter/issues/comments/365754239","html_url":"https://github.com/nunit/nunit3-vs-adapter/issues/296#issuecomment-365754239","issue_url":"https://api.github.com/repos/nunit/nunit3-vs-adapter/issues/296","id":365754239,"user":{"login":"jnm2","id":8040367,"avatar_url":"https://avatars2.githubusercontent.com/u/8040367?v=4","gravatar_id":"","url":"https://api.github.com/users/jnm2","html_url":"https://github.com/jnm2","followers_url":"https://api.github.com/users/jnm2/followers","following_url":"https://api.github.com/users/jnm2/following{/other_user}","gists_url":"https://api.github.com/users/jnm2/gists{/gist_id}","starred_url":"https://api.github.com/users/jnm2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnm2/subscriptions","organizations_url":"https://api.github.com/users/jnm2/orgs","repos_url":"https://api.github.com/users/jnm2/repos","events_url":"https://api.github.com/users/jnm2/events{/privacy}","received_events_url":"https://api.github.com/users/jnm2/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T21:41:43Z","updated_at":"2018-02-14T21:41:43Z","author_association":"CONTRIBUTOR","body":"The hang is an unrelated, preexisting issue, identical on our curent master branch."}}
{"actor":{"display_login":"jnm2"}}