Unit Testing - System.IO.FileNotFoundException Error

Hi everyone,

I know there is a couple of topics about and I have already red them. Still I couldn’t solve.

In NuGet Manager, RhinoCommon version appears 6.27.20176.5001, but tests give me error related to 6.27.20176.5000 as you see below.

System.IO.FileNotFoundException : Could not load file or assembly 'RhinoCommon, Version=6.27.20176.5000, Culture=neutral, PublicKeyToken=552281e97c755530'. The system cannot find the file specified.

I am trying to use xUnit for my plugin tests. There is a any chance this problem related to xUnit cannot support new version? Why it is complaining with old version?

Apart from this question, I am open any suggestion for Unit Test.

Thanks in advance,
-Oğuzhan

Hi @oguzhankoral,

I don’t believe anyone here (McNeel) is familiar with xUnit. A quick search on Discourse will lead to a number of threads about NUnit.

Anyway, the error is not enough for us to go on. Perhaps we need to see a sample project that replicates the error?

– Dale

Hi @dale,

I will try NUnit for my purpose. If I fail, I will let you know the situation with more specific samples.

Thanks
-Oğuzhan

[UPDATE]
Hi @dale,

I thought it was working but not working, I also tried @mingo1214’s project. It is giving same error. Although all versions in dependencies are 6.27.20176.5001.

The tests fail and give error System.IO.FileNotFoundException : Could not load file or assembly 'RhinoCommon, Version=6.27.20176.5000, Culture=neutral, PublicKeyToken=552281e97c755530' or one of its dependencies. The system cannot find the file specified.

If you have time, @mingo1214 can you try your test while updating versions of rhinocommon? Because I am encountering same error in your project without any changes except only update reference versions.

-Oğuzhan

Did it work before you updating the rhinocommon?

@mingo1214 No it was also giving same error with old version

Did you check these items:

@mingo1214, Yeap definitely I followed instructions. Actually I directly pull your repository. When I didn’t change anything, this is the error in the test project.

Also settings also same of course

2

That’s why I mentioned you in this topic in order to ask. I tried manything, but no clue why it is happening…
:thinking:

In my case, you cannot run unit tests without Rhino. This is the last two steps in above instructions:

Hmm, I thought that it is possible.
Which part of project should have this code line?

public override PlugInLoadTime LoadTime => PlugInLoadTime.AtStartup;

When I try to run test in the Rhino, it is giving NullReferenceException.

It needs to be added to RhinoPlugin project:

It should be there already in my example. Have you just tried to run “RhinoPluginCommand”? does it work? If not, then it means Rhino didn’t load the “RhinoPlugin”. You will need to drag and drop “RhinoPlugin\bin\RhinoPlugin.rhp” file to Rhino.

1 Like

Thanks for your patient, sorry. It’s working now.

Maybe you may have add this step also in the 3rd bullet in case of someone can possibly miss like me :slight_smile:

I will try same approach for my plugin. Thanks for your contribution for NUnit!
-Oğuzhan