Bug 5716 - MissingMethodException thrown on the console or in a dialog
Summary: MissingMethodException thrown on the console or in a dialog
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NUnit ()
Version: Trunk
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2012-06-18 18:12 UTC by Andres G. Aragoneses
Modified: 2012-06-30 10:37 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Andres G. Aragoneses 2012-06-18 18:12:56 UTC
When debugging MonoDevelop inside MonoDevelop I sometimes see this exception:

System.MissingMethodException: Method not found: 'NUnit.Core.TestSuiteBuilder.Build'.  at (wrapper xdomain-invoke) MonoDevelop.NUnit.External.NUnitTestRunner:GetTestInfo (string,System.Collections.Generic.List`1<string>)
  at (wrapper remoting-invoke-with-check) MonoDevelop.NUnit.External.NUnitTestRunner:GetTestInfo (string,System.Collections.Generic.List`1<string>)
  at MonoDevelop.NUnit.External.ExternalTestRunner.GetTestInfo (System.String path, System.Collections.Generic.List`1 supportAssemblies) [0x00008] in /home/andres1204/Documents/code/monostuff/monodevelopHEAD/main/src/addins/NUnit/Services/ExternalTestRunner.cs:90 
  at (wrapper managed-to-native) System.Runtime.Remoting.RemotingServices:InternalExecute (System.Reflection.MethodBase,object,object[],object[]&)
  at System.Runtime.Remoting.RemotingServices.InternalExecuteMessage (System.MarshalByRefObject target, IMethodCallMessage reqMsg) [0x00000] in <filename unknown>:0 

Exception rethrown at [1]: 

  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg, System.Exception& exc, System.Object[]& out_args) [0x00000] in <filename unknown>:0 
Missing method NUnit.Core.TestSuiteBuilder::Build(TestPackage) in assembly /home/knocte/Documents/code/monostuff/monodevelopHEAD/main/build/AddIns/NUnit/nunit.core.dll, referenced in assembly /home/knocte/Documents/code/monostuff/monodevelopHEAD/main/build/AddIns/NUnit/NUnitRunner.dll
System.MissingMethodException: Method not found: 'NUnit.Core.TestSuiteBuilder.Build'.  at (wrapper xdomain-invoke) MonoDevelop.NUnit.External.NUnitTestRunner:GetTestInfo (string,System.Collections.Generic.List`1<string>)
  at (wrapper remoting-invoke-with-check) MonoDevelop.NUnit.External.NUnitTestRunner:GetTestInfo (string,System.Collections.Generic.List`1<string>)
  at MonoDevelop.NUnit.External.ExternalTestRunner.GetTestInfo (System.String path, System.Collections.Generic.List`1 supportAssemblies) [0x00008] in /home/andres1204/Documents/code/monostuff/monodevelopHEAD/main/src/addins/NUnit/Services/ExternalTestRunner.cs:90 
  at (wrapper managed-to-native) System.Runtime.Remoting.RemotingServices:InternalExecute (System.Reflection.MethodBase,object,object[],object[]&)
  at System.Runtime.Remoting.RemotingServices.InternalExecuteMessage (System.MarshalByRefObject target, IMethodCallMessage reqMsg) [0x00000] in <filename unknown>:0 

Exception rethrown at [1]: 

  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg, System.Exception& exc, System.Object[]& out_args) [0x00000] in <filename unknown>:0 
Missing method NUnit.Core.TestSuiteBuilder::Build(TestPackage) in assembly /home/knocte/Documents/code/monostuff/monodevelopHEAD/main/build/AddIns/NUnit/nunit.core.dll, referenced in assembly /home/knocte/Documents/code/monostuff/monodevelopHEAD/main/build/AddIns/NUnit/NUnitRunner.dll



Problem is, when I see it in a dialog instead of just in the console, all my UI hangs, and I have to restart the system. It happens in Ubuntu 12.04 64 bits.
Comment 1 Andres G. Aragoneses 2012-06-18 18:40:18 UTC
Sadly in OpenSUSE 12.1 64 bits happens the same.
Comment 2 Andres G. Aragoneses 2012-06-18 18:56:27 UTC
I've run it also with Lluis' gui-thread-check tool and it seems to not give any hint of bad non-gui thread usage.
Comment 3 Mike Krüger 2012-06-21 01:53:30 UTC
Seems that there is a wrong nunit .dll floating around somewhere in your directory - md compiles, therefore that method exists in the nunit we're shipping.

Try to look if in main/build/tests are nunit*.dll files and remove them.
Comment 4 Andres G. Aragoneses 2012-06-21 09:40:49 UTC
Mike, you may be right, but that "floating" dll may as well come from the MonoDevelop repository. I plan to investigate more so let's keep the bug open until we find the real root cause.

I just did an md5sum on all nunit.core.dlls that I have in the tree and this is the result:

$ find . | grep nunit\.core\.dll | xargs md5sum
fab589d2a49afb1165bc4249fefeae47  ./main/build/tests/nunit.core.dll
fab589d2a49afb1165bc4249fefeae47  ./main/build/AddIns/NUnit/nunit.core.dll
fab589d2a49afb1165bc4249fefeae47  ./main/src/addins/NUnit/lib/nunit.core.dll
fab589d2a49afb1165bc4249fefeae47  ./main/src/addins/NUnit/Test/bin/Debug/nunit.core.dll
5159f28b39b2c6213bd1c31e5e48299a  ./main/external/cecil/symbols/pdb/Test/bin/net_4_0_Debug/nunit.core.dll
5159f28b39b2c6213bd1c31e5e48299a  ./main/external/cecil/symbols/mdb/Test/bin/net_4_0_Debug/nunit.core.dll
5159f28b39b2c6213bd1c31e5e48299a  ./main/external/cecil/Test/bin/net_4_0_Debug/nunit.core.dll
5159f28b39b2c6213bd1c31e5e48299a  ./main/external/cecil/Test/libs/nunit-2.5.10/nunit.core.dll
5159f28b39b2c6213bd1c31e5e48299a  ./main/external/cecil/rocks/Test/bin/net_4_0_Debug/nunit.core.dll
fab589d2a49afb1165bc4249fefeae47  ./main/external/mdtestharness/lib/nunit.core.dll

So there are only 2 versions of the DLL. I will now check which one lacks the missing method.
Comment 5 Mike Krüger 2012-06-21 12:10:01 UTC
I think the 5159f28b39b2c6213bd1c31e5e48299a is the wrong one.

@Alan: Do you know something about that dll ?

For me it ends up in main/build/tests and that causes that the tests can't be run inside monodevelop - without removing them. A 'make' does do that. 

I know makefile system - but I guess it's some of the recent makefile changes causing the issue.
Comment 6 Alan McGovern 2012-06-21 12:23:47 UTC
5159f28b39b2c6213bd1c31e5e48299a is the wrong file, but i have no idea where it's coming from. Can you describe exactly how you build and execute md?
Comment 7 Andres G. Aragoneses 2012-06-21 14:40:12 UTC
./configure && make && make run
Comment 8 Andres G. Aragoneses 2012-06-21 16:52:15 UTC
I just have checked the output of monodis on the "wrong file", and I see the method:

    // method line 553
    .method public hidebysig
           instance default class NUnit.Core.TestSuite Build (class [nunit.core.interfaces]NUnit.Core.TestPackage package)  cil managed
    {
        // Method begins at RVA 0xaea4
        // Code size 528 (0x210)
        .maxstack 5
        .locals init (

However if I monodis the other file it is when I don't find the Build method in NUnit.Core.TestSuite.
Comment 9 Andres G. Aragoneses 2012-06-21 17:28:10 UTC
In a clean checkout:

$ find . | grep nunit\.core\.dll | xargs md5sum
fab589d2a49afb1165bc4249fefeae47  ./main/src/addins/NUnit/lib/nunit.core.dll

And after 'git submodule update --init' in the clean checkout:

fab589d2a49afb1165bc4249fefeae47  ./main/src/addins/NUnit/lib/nunit.core.dll
5159f28b39b2c6213bd1c31e5e48299a  ./main/external/cecil/Test/libs/nunit-2.5.10/nunit.core.dll
fab589d2a49afb1165bc4249fefeae47  ./main/external/mdtestharness/lib/nunit.core.dll

So I think we just have to update the DLLs in main/src/addins/NUnit/lib/ and mdtestharness/lib/ with the one in cecil/Test/libs/nunit-2.5.10/.
Comment 10 Alan McGovern 2012-06-21 18:55:40 UTC
5159f28b39b2c6213bd1c31e5e48299a is definitely wrong. It's not used in the monodevelop build so if it's ending up inside our build directory, something has gone seriously wrong in the build. I'm investigating this now...
Comment 11 Alan McGovern 2012-06-21 19:45:50 UTC
I just grabbed a fresh copy of monodevelop master and conducted some tests.

1) ./configure && make

MD5 (./main/build/AddIns/NUnit/nunit.core.dll) = fab589d2a49afb1165bc4249fefeae47



2) ./configure --enable-tests && make

MD5 (./main/build/AddIns/NUnit/nunit.core.dll) = fab589d2a49afb1165bc4249fefeae47
MD5 (./main/build/tests/nunit.core.dll) = fab589d2a49afb1165bc4249fefeae47

The correct library ends up in the output directory in both cases. This is the one the unit test harness is compiled against. The 'wrong' library exists only in ./main/external/cecil, which is as expected. However the error message makes no sense. It's complaining that TestSuiteBuilder.Build (TestPackage) does not exist, yet the assembly with hash fab589 definitely does contain this method. My guess is that for some bizarre reason, the correct assembly is not being loaded at runtime and this bug is then triggering.

It will need more investigation :(
Comment 12 Andres G. Aragoneses 2012-06-21 20:08:45 UTC
Alan, thanks for your investigation, but I noticed the opposite: that 5159f28b39b2c6213bd1c31e5e48299a has the method but fab589d2a49afb1165bc4249fefeae47 doesn't. How did you check it? Can you check 515...?
Comment 13 Alan McGovern 2012-06-21 20:13:40 UTC
The bug should be fixed with commit e40fd284c in monodevelop/master. We were not loading the nunit.core assembly into the test runners appdomain which resulted in this error.

Just for reference, if you monodis the nunit.core.dll assembly with hash fab58, you should find the method on line 23833. Just search for the text ' instance default class NUnit.Core.TestSuite Build (class [nunit.core.interfaces]NUnit.Core.TestPackage package)'. That should bring you to the method inside the TestSuiteBuilder class.
Comment 14 Andres G. Aragoneses 2012-06-21 20:24:42 UTC
You're right, now I see the method, I guess I was looking at it not slowly enough.

However, I still don't understand why it wouldn't find the method in the 519f assembly, as it's there.

Anyway, going to test your fix soon, thanks very much.
I'll open another bug for the fact that an exception shouldn't be caught in the dialog anyway (this may be a bug of MonoSoftDebugger when used in combination of Assembly.Load or Remoting, which is the case here).
Comment 15 Andres G. Aragoneses 2012-06-23 14:01:30 UTC
Tested latest master branch. Unfortunately the problem is still there.
Comment 16 Andres G. Aragoneses 2012-06-26 11:24:10 UTC
The stacktrace is the same (and yes, it's a brand new checkout with alan's commit, I nuked the dir and I even cloned monodevelop again to make sure):


System.MissingMethodException: Method not found: 'NUnit.Core.TestSuiteBuilder.Build'.  at (wrapper xdomain-invoke) MonoDevelop.NUnit.External.NUnitTestRunner:GetTestInfo (string,System.Collections.Generic.List`1<string>)
  at (wrapper remoting-invoke-with-check) MonoDevelop.NUnit.External.NUnitTestRunner:GetTestInfo (string,System.Collections.Generic.List`1<string>)
  at MonoDevelop.NUnit.External.ExternalTestRunner.GetTestInfo (System.String path, System.Collections.Generic.List`1 supportAssemblies) [0x00008] in /home/knocte/Documents/code/monostuff/monodevelop-clean/main/src/addins/NUnit/Services/ExternalTestRunner.cs:90 
  at (wrapper managed-to-native) System.Runtime.Remoting.RemotingServices:InternalExecute (System.Reflection.MethodBase,object,object[],object[]&)
  at System.Runtime.Remoting.RemotingServices.InternalExecuteMessage (System.MarshalByRefObject target, IMethodCallMessage reqMsg) [0x00000] in <filename unknown>:0 

Exception rethrown at [1]: 

  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg, System.Exception& exc, System.Object[]& out_args) [0x00000] in <filename unknown>:0 
Missing method NUnit.Core.TestSuiteBuilder::Build(TestPackage) in assembly /home/knocte/Documents/code/monostuff/monodevelop-clean/main/build/AddIns/NUnit/nunit.core.dll, referenced in assembly /home/knocte/Documents/code/monostuff/monodevelop-clean/main/build/AddIns/NUnit/NUnitRunner.dll
System.MissingMethodException: Method not found: 'NUnit.Core.TestSuiteBuilder.Build'.  at (wrapper xdomain-invoke) MonoDevelop.NUnit.External.NUnitTestRunner:GetTestInfo (string,System.Collections.Generic.List`1<string>)
  at (wrapper remoting-invoke-with-check) MonoDevelop.NUnit.External.NUnitTestRunner:GetTestInfo (string,System.Collections.Generic.List`1<string>)
  at MonoDevelop.NUnit.External.ExternalTestRunner.GetTestInfo (System.String path, System.Collections.Generic.List`1 supportAssemblies) [0x00008] in /home/knocte/Documents/code/monostuff/monodevelop-clean/main/src/addins/NUnit/Services/ExternalTestRunner.cs:90 
  at (wrapper managed-to-native) System.Runtime.Remoting.RemotingServices:InternalExecute (System.Reflection.MethodBase,object,object[],object[]&)
  at System.Runtime.Remoting.RemotingServices.InternalExecuteMessage (System.MarshalByRefObject target, IMethodCallMessage reqMsg) [0x00000] in <filename unknown>:0 

Exception rethrown at [1]: 

  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg, System.Exception& exc, System.Object[]& out_args) [0x00000] in <filename unknown>:0 
Missing method NUnit.Core.TestSuiteBuilder::Build(TestPackage) in assembly /home/knocte/Documents/code/monostuff/monodevelop-clean/main/build/AddIns/NUnit/nunit.core.dll, referenced in assembly /home/knocte/Documents/code/monostuff/monodevelop-clean/main/build/AddIns/NUnit/NUnitRunner.dll
Comment 17 Alan McGovern 2012-06-28 19:28:01 UTC
Phew, fixed in git. We needed to split up some code so that we correctly preloaded the required assemblies to run the test harness.
Comment 18 Andres G. Aragoneses 2012-06-30 10:37:53 UTC
Alan: I've udpated my MD and tested your fix, and it works!

Debugging MonoDevelop inside MonoDevelop is now much less painful :)