nunit / nunit-vs-adapter

Runs NUnit V2 tests inside the Visual Studio 2012 or later Test Explorer window.
MIT License
50 stars 43 forks source link

Nunit Adapter 2.1.1 can't find the dependent assembly and lead to no test found issue #170

Open liagao opened 6 years ago

liagao commented 6 years ago

I am using VS2017 with this NUnit2 vsix. Some of the test projects are ok to run, but some of them will report the following error. Seems the dependent assembly can not be found, but the error message doesn't mentioned which assembly is missing, can anyone help on this? My Nunit version is 2.6.4. [4/13/2018 12:23:10 Informational] ------ Run test started ------ [4/13/2018 12:23:11 Informational] NUnit VS Adapter 2.1.1.0 executing tests is started [4/13/2018 12:23:11 Informational] Loading tests from d:\gitsrc\xapplatform\private\xap\XapDataPlatformClient\XapClient.Test\objd\amd64\XapClient.Test.dll [4/13/2018 12:23:11 Informational] TFS Filter detected: LoadedTestCases 99, Filterered Test Cases 99 [4/13/2018 12:23:12 Informational] Run started: d:\gitsrc\xapplatform\private\xap\XapDataPlatformClient\XapClient.Test\objd\amd64\XapClient.Test.dll [4/13/2018 12:23:35 Informational] NUnit VS Adapter 2.1.1.0 executing tests is finished [4/13/2018 12:23:35 Informational] ========== Run test finished: 98 run (0:00:25.0745155) ========== [4/13/2018 12:28:49 Informational] ------ Run test started ------ [4/13/2018 12:28:50 Informational] NUnit VS Adapter 2.1.1.0 executing tests is started [4/13/2018 12:28:51 Informational] Loading tests from d:\gitsrc\xapplatform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.Tests.dll [4/13/2018 12:28:51 Warning] Dependent Assembly of d:\gitsrc\xapplatform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.Tests.dll not found. Can be ignored if not a NUnit project. [4/13/2018 12:28:51 Informational] NUnit VS Adapter 2.1.1.0 executing tests is finished [4/13/2018 12:28:51 Warning] No test is available in d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.Tests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

OsirisTerje commented 6 years ago

Can you please upload a repro project? Make it as small as you can, it should compile "as is".

rprouse commented 6 years ago

Looking through the errors, it looks like your tests are targeting AMD64 and your bin folders look like some sort of Cross-Plat framework. What .NET Framework and OS Platform are you targeting. NUnit 2.x only supports the full .NET Framework.

liagao commented 6 years ago

Several things here.

My project can be run successfully within ReSharper several days ago. Now, I am using the VS2017 with Nunit 2.1.1 instead of ReSharper. Here is the project config: [cid:image001.png@01D3F2B1.8900A390]

Attached is the csproj file. The setting is not that different with other test projects. I am curious why the error message not specified which dependent assembly is not found so that I can check whether it is something wrong with that assembly.

Thanks a lot Lianyong

From: Rob Prouse notifications@github.com Sent: Wednesday, May 23, 2018 03:25 To: nunit/nunit-vs-adapter nunit-vs-adapter@noreply.github.com Cc: Lianyong Gao (GEORGE) liagao@microsoft.com; Author author@noreply.github.com Subject: Re: [nunit/nunit-vs-adapter] Nunit Adapter 2.1.1 can't find the dependent assembly and lead to no test found issue (#170)

Looking through the errors, it looks like your tests are targeting AMD64 and your bin folders look like some sort of Cross-Plat framework. What .NET Framework and OS Platform are you targeting. NUnit 2.x only supports the full .NET Framework.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnunit%2Fnunit-vs-adapter%2Fissues%2F170%23issuecomment-391111279&data=02%7C01%7Cliagao%40microsoft.com%7C1c9ce16c019346b0a25d08d5c019b6fb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636626139032328610&sdata=0hztsQ%2F8rO5%2F4CD2ReBPihJ97dOTTEc67Zq5gavI8Cs%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAlh9GANhksd71Ua9j3-YZNnlh7ktqk2mks5t1GYNgaJpZM4UCOyk&data=02%7C01%7Cliagao%40microsoft.com%7C1c9ce16c019346b0a25d08d5c019b6fb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636626139032338622&sdata=Bqv912dCNIZaASU%2BckrU2qkJujDTEHEMEOlLTLnHUZ4%3D&reserved=0.

OsirisTerje commented 6 years ago

@liagao No attachments, nor image. To see what assemblies it tries to load and not finding, enable the fuslogviewer. You only need to look at the resulting log files.

liagao commented 6 years ago

Terje,

Thanks for your reply. Here is the fusion log for this test project. I didn’t see what dependent assembly is not found, seems the test assembly has been loaded correctly.

Assembly Binder Log Entry (5/23/2018 @ 20:36:35)

The operation was successful. Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS\TESTPLATFORM\testhost.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Xap.PreMergePerformanceGate.Activities.Library, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///d:/gitsrc/xap_platform/private/xap/XapDataPlatform/Xap.PreMergePerformanceGate.Activities.Library/unittest/objd/amd64/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = Tests_1073362078 Calling assembly : Xap.PreMergePerformanceGate.Activities.Library.Tests, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context. LOG: Using application configuration file: d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.Tests.dll.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///d:/gitsrc/xap_platform/private/xap/XapDataPlatform/Xap.PreMergePerformanceGate.Activities.Library/unittest/objd/amd64/Xap.PreMergePerformanceGate.Activities.Library.DLL. LOG: Assembly download was successful. Attempting setup of file: d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.dll LOG: Entering run-from-source setup phase. LOG: Assembly Name is: Xap.PreMergePerformanceGate.Activities.Library, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null LOG: Binding succeeds. Returns assembly from d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.dll. LOG: Assembly is loaded in default load context.

Assembly Binder Log Entry (5/23/2018 @ 20:36:35)

The operation was successful. Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS\TESTPLATFORM\testhost.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Xap.PreMergePerformanceGate.Activities.Library, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///d:/gitsrc/xap_platform/private/xap/XapDataPlatform/Xap.PreMergePerformanceGate.Activities.Library/unittest/objd/amd64/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = Tests_1073362078 Calling assembly : Xap.PreMergePerformanceGate.Activities.Library.Tests, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context. LOG: Using application configuration file: d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.Tests.dll.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///d:/gitsrc/xap_platform/private/xap/XapDataPlatform/Xap.PreMergePerformanceGate.Activities.Library/unittest/objd/amd64/Xap.PreMergePerformanceGate.Activities.Library.DLL. LOG: Assembly download was successful. Attempting setup of file: d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.dll LOG: Entering run-from-source setup phase. LOG: Assembly Name is: Xap.PreMergePerformanceGate.Activities.Library, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null LOG: Binding succeeds. Returns assembly from d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.dll. LOG: Assembly is loaded in default load context.

Thanks a lot Lianyong

From: Terje Sandstrom notifications@github.com Sent: Wednesday, May 23, 2018 19:34 To: nunit/nunit-vs-adapter nunit-vs-adapter@noreply.github.com Cc: Lianyong Gao (GEORGE) liagao@microsoft.com; Mention mention@noreply.github.com Subject: Re: [nunit/nunit-vs-adapter] Nunit Adapter 2.1.1 can't find the dependent assembly and lead to no test found issue (#170)

@liagaohttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliagao&data=02%7C01%7Cliagao%40microsoft.com%7Ce4d780b6ee09492d64c108d5c0a118a0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636626720486151889&sdata=0%2FVPsT46HcI9Inoqj7zsVs6uC9oDwwNrw9lnWlNkGdc%3D&reserved=0 No attachments, nor image. To see what assemblies it tries to load and not finding, enable the fuslogviewer. You only need to look at the resulting log files.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnunit%2Fnunit-vs-adapter%2Fissues%2F170%23issuecomment-391314842&data=02%7C01%7Cliagao%40microsoft.com%7Ce4d780b6ee09492d64c108d5c0a118a0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636626720486151889&sdata=3Giu1sC%2BLzyiQBpy3OSyb9OENnss7kORzYOGRsbotC0%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAlh9GBjG0IPsJm5GCiwLolHROvyYioqtks5t1UkvgaJpZM4UCOyk&data=02%7C01%7Cliagao%40microsoft.com%7Ce4d780b6ee09492d64c108d5c0a118a0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636626720486151889&sdata=X91pQ0ReUHCiajsGt3JuAc1tm2og9RlISKwwiCf%2Fhe8%3D&reserved=0.

liagao commented 6 years ago

Hi all,

Just found an interesting thing. I uninstalled the Nunit Adapter 2.1.1 and then ran this test project with Nuit adapter 1.1.0 which is a build in plugin in VS2017, it worked! I tried some other test projects and found that the ones can run in 2.1.1 can’t run in 1.1.0 while the ones can run in 1.1.0 can’t run in 2.1.0. Not sure there is any obvious change between 1.1.0 and 2.1.0.

Thanks a lot Lianyong

From: Lianyong Gao (GEORGE) Sent: Wednesday, May 23, 2018 20:44 To: 'nunit/nunit-vs-adapter' reply@reply.github.com; nunit/nunit-vs-adapter nunit-vs-adapter@noreply.github.com Cc: Mention mention@noreply.github.com Subject: RE: [nunit/nunit-vs-adapter] Nunit Adapter 2.1.1 can't find the dependent assembly and lead to no test found issue (#170)

Terje,

Thanks for your reply. Here is the fusion log for this test project. I didn’t see what dependent assembly is not found, seems the test assembly has been loaded correctly.

Assembly Binder Log Entry (5/23/2018 @ 20:36:35)

The operation was successful. Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS\TESTPLATFORM\testhost.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Xap.PreMergePerformanceGate.Activities.Library, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///d:/gitsrc/xap_platform/private/xap/XapDataPlatform/Xap.PreMergePerformanceGate.Activities.Library/unittest/objd/amd64/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = Tests_1073362078 Calling assembly : Xap.PreMergePerformanceGate.Activities.Library.Tests, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context. LOG: Using application configuration file: d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.Tests.dll.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///d:/gitsrc/xap_platform/private/xap/XapDataPlatform/Xap.PreMergePerformanceGate.Activities.Library/unittest/objd/amd64/Xap.PreMergePerformanceGate.Activities.Library.DLL. LOG: Assembly download was successful. Attempting setup of file: d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.dll LOG: Entering run-from-source setup phase. LOG: Assembly Name is: Xap.PreMergePerformanceGate.Activities.Library, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null LOG: Binding succeeds. Returns assembly from d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.dll. LOG: Assembly is loaded in default load context.

Assembly Binder Log Entry (5/23/2018 @ 20:36:35)

The operation was successful. Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS\TESTPLATFORM\testhost.exe --- A detailed error log follows.

=== Pre-bind state information === LOG: DisplayName = Xap.PreMergePerformanceGate.Activities.Library, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///d:/gitsrc/xap_platform/private/xap/XapDataPlatform/Xap.PreMergePerformanceGate.Activities.Library/unittest/objd/amd64/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = Tests_1073362078 Calling assembly : Xap.PreMergePerformanceGate.Activities.Library.Tests, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context. LOG: Using application configuration file: d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.Tests.dll.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///d:/gitsrc/xap_platform/private/xap/XapDataPlatform/Xap.PreMergePerformanceGate.Activities.Library/unittest/objd/amd64/Xap.PreMergePerformanceGate.Activities.Library.DLL. LOG: Assembly download was successful. Attempting setup of file: d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.dll LOG: Entering run-from-source setup phase. LOG: Assembly Name is: Xap.PreMergePerformanceGate.Activities.Library, Version=7.8.0.0, Culture=neutral, PublicKeyToken=null LOG: Binding succeeds. Returns assembly from d:\gitsrc\xap_platform\private\xap\XapDataPlatform\Xap.PreMergePerformanceGate.Activities.Library\unittest\objd\amd64\Xap.PreMergePerformanceGate.Activities.Library.dll. LOG: Assembly is loaded in default load context.

Thanks a lot Lianyong

From: Terje Sandstrom notifications@github.com<mailto:notifications@github.com> Sent: Wednesday, May 23, 2018 19:34 To: nunit/nunit-vs-adapter nunit-vs-adapter@noreply.github.com<mailto:nunit-vs-adapter@noreply.github.com> Cc: Lianyong Gao (GEORGE) liagao@microsoft.com<mailto:liagao@microsoft.com>; Mention mention@noreply.github.com<mailto:mention@noreply.github.com> Subject: Re: [nunit/nunit-vs-adapter] Nunit Adapter 2.1.1 can't find the dependent assembly and lead to no test found issue (#170)

@liagaohttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliagao&data=02%7C01%7Cliagao%40microsoft.com%7Ce4d780b6ee09492d64c108d5c0a118a0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636626720486151889&sdata=0%2FVPsT46HcI9Inoqj7zsVs6uC9oDwwNrw9lnWlNkGdc%3D&reserved=0 No attachments, nor image. To see what assemblies it tries to load and not finding, enable the fuslogviewer. You only need to look at the resulting log files.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnunit%2Fnunit-vs-adapter%2Fissues%2F170%23issuecomment-391314842&data=02%7C01%7Cliagao%40microsoft.com%7Ce4d780b6ee09492d64c108d5c0a118a0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636626720486151889&sdata=3Giu1sC%2BLzyiQBpy3OSyb9OENnss7kORzYOGRsbotC0%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAlh9GBjG0IPsJm5GCiwLolHROvyYioqtks5t1UkvgaJpZM4UCOyk&data=02%7C01%7Cliagao%40microsoft.com%7Ce4d780b6ee09492d64c108d5c0a118a0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636626720486151889&sdata=X91pQ0ReUHCiajsGt3JuAc1tm2og9RlISKwwiCf%2Fhe8%3D&reserved=0.