Mono cannot find dll that seems to exist - vb.net

I have just upgraded my 64-bit ubuntu 14.04.2 LTS to the latest mono. I followed the instructions on this page a few months ago, and before today had been using mono 3 without issue. Today I upgraded, which moved me to mono 4.0.1:
$ mono --version
Mono JIT compiler version 4.0.1 (tarball Tue Apr 28 11:47:58 UTC 2015)
I have successfully compiled this program using monodevelop, but the exact same issue manifests with a VS2013-compiled binary [newlines exactly as they appear in the output]:
$ file RTAM_Basic_Pre.exe
RTAM_Basic_Pre.exe: PE32 executable (console) Intel 80386 Mono/.Net Assembly, for MS Windows
$ mono RTAM_Basic_Pre.exe
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualBasic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'Microsoft.VisualBasic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualBasic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
File name: 'Microsoft.VisualBasic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Thing is, I'm really quite sure that file exists:
$ pwd
/usr/lib/mono/gac/Microsoft.VisualBasic/11.0.0.0__b03f5f7f11d50a3a
$ ls -l
-rw-r--r-- 1 root root 350720 Apr 27 12:00 Microsoft.VisualBasic.dll
$ file Microsoft.VisualBasic.dll
Microsoft.VisualBasic.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Windows
It's possible that the error is the "... or one of its depedencies", but it's not clear to me how actually diagnose what's happening.

Through tracing a simple VB helloworld program with MONO_LOG_LEVEL=debug MONO_LOG_MASK=asm I found the following:
Mono: The request to load the assembly Microsoft.VisualBasic v11.0.0.0 was remapped to v10.0.0.0
Turns out the v11.0.0.0 version number is actually incorrect, this pull request should fix it: https://github.com/mono/mono-basic/pull/8

The first thing I would try in a situation like this is to see if the system can fix the dependencies itself. The first few steps on the installation guide should have set you up with the needed repositories. In the shell, try executing:
sudo apt-get install -f mono-complete
The '-f' flag should tell the system to make sure the dependencies are there.
I hope this can be of help! Apologies if that doesn't turn out to be the case. 030

Related

Visual Studio Online test runner can't load SpecFlow dll

I've added SpecFlow using Nuget and have a single spec (so it is a simple project). I've created a build in VS online 2015 using the web build editor.
Maybe it's a Nuget new build system issue? I'm not sure if it just a SpecFlow thing and haven't gotten a chance try straight MS unit tests yet.
An exception occurred while invoking executor
'executor://mstestadapter/v1': Could not load file or assembly
'TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral,
PublicKeyToken=0778194805d6db41' or one of its dependencies. The
system cannot find the file specified.
Here's a larger stack trace:
1. 2015-08-03T21:26:27.6325511Z Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\tasks\VSTest\1.0.16\VSTest.ps1
2. 2015-08-03T21:26:28.4231183Z ##[debug]Calling Invoke-VSTest for all test assemblies
3. 2015-08-03T21:26:28.4481177Z Working folder: C:\a\14076a40
4. 2015-08-03T21:26:28.4481177Z Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "C:\a\14076a40\SpecByExample\SpecByExample.Specs\bin\Debug\SpecByExample.Specs.dll" "C:\a\14076a40\SpecByExample\SpecByExample.Specs\bin\Debug\SpecByExample.Specs.dll.config" "C:\a\14076a40\SpecByExample\SpecByExample.Specs\obj\Debug\SpecByExample.Specs.dll" /logger:trx
5. 2015-08-03T21:26:29.4654019Z Microsoft (R) Test Execution Command Line Tool Version 14.0.23107.0
6. 2015-08-03T21:26:29.4664025Z Copyright (c) Microsoft Corporation. All rights reserved.
7. 2015-08-03T21:26:29.4664025Z Starting test execution, please wait...
8. 2015-08-03T21:26:29.7564024Z Warning: Unable to load types from the test source 'C:\a\14076a40\SpecByExample\SpecByExample.Specs\obj\Debug\SpecByExample.Specs.dll'. Some or all of the tests in this source may not be discovered. If you are running unit tests for Windows Store apps and referencing custom WinMD type then please visit http://go.microsoft.com/fwlink/?LinkId=238340 for more info. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'SpecResults, Version=0.1.0.7, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
9. 2015-08-03T21:26:29.7574029Z .
10. 2015-08-03T21:26:40.6922424Z Passed TheUserVisitsTheWebsite
11. 2015-08-03T21:26:41.3214684Z ##[error]Error: An exception occurred while invoking executor 'executor://mstestadapter/v1': Could not load file or assembly 'TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral, PublicKeyToken=0778194805d6db41' or one of its dependencies. The system cannot find the file specified.
12. 2015-08-03T21:26:41.3224680Z ##[error]
13. 2015-08-03T21:26:41.4936886Z Results File: C:\a\14076a40\TestResults\buildguest_TASKAGENT-0007 2015-08-03 21_26_40.trx
14. 2015-08-03T21:26:41.4956876Z Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.
15. 2015-08-03T21:26:41.4966881Z ##[error]Test Run Failed.
16. 2015-08-03T21:26:41.4966881Z Test execution time: 11.8787 Seconds
17. 2015-08-03T21:26:41.7581094Z ##[error]VSTest Test Run failed with exit code: 1
18. 2015-08-03T21:26:41.7741099Z Publishing Test Results...
2015-08-03T21:26:43.0372165Z Test results remaining: 1
UPDATE: I disabled the SpecFlow test and added the simplest AboutController test possible (from file new project MVC in Visual Studio). I still get a 'could not load assembly problem. SpecByExample.Web is my MVC project in my solution.
2015-08-07T16:16:56.7251975Z ##[error]Error Message:
2015-08-07T16:16:56.7261978Z ##[error] Test method
SpecByExample.Web.Tests.Controllers.HomeControllerTests.AboutTest
threw exception: 2015-08-07T16:16:56.7261978Z
[error]System.IO.FileNotFoundException: Could not load file or assembly 'SpecByExample.Web, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The system cannot
find the file specified.WRN: Assembly binding logging is turned OFF.
2015-08-07T16:16:56.7271982Z ##[error]To enable assembly bind failure
logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
2015-08-07T16:16:56.7271982Z ##[error]Note: There is some performance
penalty associated with assembly bind failure logging.
2015-08-07T16:16:56.7281979Z ##[error]To turn this feature off, remove
the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
2015-08-07T16:16:56.7281979Z ##[error] 2015-08-07T16:16:56.7291971Z
[error]Stack Trace: 2015-08-07T16:16:56.7291971Z ##[error] at SpecByExample.Web.Tests.Controllers.HomeControllerTests.AboutTest()
2015-08-07T16:16:56.7831986Z Results File:
C:\a\14076a40\TestResults\buildguest_TASKAGENT-0007 2015-08-07
16_16_56.trx 2015-08-07T16:16:56.7861977Z Attachments:
2015-08-07T16:16:56.7861977Z ##[error]Test Run Failed.
Here's a screenshot of my build definition:
In Run unit test step. click advance and give path to your packages folder. (if you are using nuget it will download all dependencies there) give it a try and let me know how it goes.

Loading a DLL in the GAC

currently I have a problem with getting a DLL into the Windows GAC. I tried to follow the steps of creating a DLL and loading it as described in this blog post:
http://blogs.technet.com/b/cloudpfe/archive/2014/02/01/how-to-create-a-custom-authentication-provider-for-active-directory-federation-services-3-0-part-2.aspx
At the point where I try calling the following command:
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7514a164b89fa979")
I get an error which tells me that System.EnterpriseServices could not be found:
Exception calling "Load" with "1" argument(s): "Could not load file or
assembly 'System.EnterpriseServices, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=7514a164b89fa979' or one of its dependencies. The
system cannot find the file specified."
The specified DLL (System.EnterpriseServices) does exist* on the machine.
So now my question is, why can't this method find the DLL and what do I have to do/change to get this command to work?
NOTE: I Tried this on a vanilla Windows Server 2012 R2 with just ADFS parts installed; And I've called the command from the Powershell.
*UPDATE: The System.EnterpriseServices DLL resides in
C:\Windows\Microsoft.NET\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a
and
C:\Windows\WinSxS\amd64_system.enterpriseservices_b03f5f7f11d50a3a_4.0.9600.1638‌​4_none_53a3f9b13fac0ba5\
So it should be available from the GAC.
I think your public Key token is incorrect, you found your own answer with your update :) .
It should be
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
Give this a try.

Running SSIS package on SQL 2014

I created a new sql job in SQL2014 with an SSIS package created in SQL 2005.
The job is failing with this error:
Source: Ready data to zip Ready data to zip Description: There was an exception while loading Script Task from XML: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Tools.Applications.Core, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Tools.Applications.Core, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Microsoft.SqlServer.IntegrationServices.VSTA.VstaHelper.b__1a() at Microsoft.SqlServer.VSTAHosting.VSTAScriptingEngine.DisposeVstaHelper() at Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptTask.MigrateVSAScriptTask(XmlElement elemProj, IDTSInfoEvents events) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptTask.LoadFromXML(XmlElement elemProj, IDTSInfoEvents events)
Can you please explain the error? I think I'm missing some files.
This is a longshot, but you may be attempting to run the 32-bit version of DTExec. By default, it's not installed on a 64-bit machine unless you install the client components - which may mean you have an incomplete installation.

IronPython + Mono error - could not load signature

When trying to run IronPython from Mono, I get the following error:
wayne#arglefraster ~/Downloads/IronPython-2.7.3 ⚘ mono ipy.exe 19:19:23
Could not load signature of IronPython.Runtime.List:get_Item due to:
Failed to load language 'IronPython 2.7': Could not load type 'IronPython.Runtime.List' from assembly 'IronPython, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1'.
Fiddling around here on SO I found MONO_LOG_LEVEL=debug, and got this relevant information
Mono: Assembly Loader probing location: '/usr/lib/System.Numerics.exe'.
Mono: The following assembly referenced from /home/wayne/Downloads/IronPython-2.7.3/IronPython.dll could not be loaded:
Assembly: System.Numerics (assemblyref_index=5)
Version: 4.0.0.0
Public Key: b77a5c561934e089
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/home/wayne/Downloads/IronPython-2.7.3/).
Mono: Failed to load assembly IronPython[0xddd180]
Mono: Could not load file or assembly 'System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Could not load signature of IronPython.Runtime.List:get_Item due to:
Mono: gc took 520 usecs
Mono: Unloading domain ipy.exe[0x7faebd540cc0], assembly IronPython[0xddd180], ref_count=2
How can I get this working?
It turns out that the Numerics library wasn't installed:
wayne#arglefraster ~/Downloads/IronPython-2.7.3 ⚘ apt-cache search mono numerics
libmono-system-numerics4.0-cil - Mono System.Numerics library (for CLI 4.0)
wayne#arglefraster ~/Downloads/IronPython-2.7.3 ⚘ sudo apt-get install libmono-system-numerics4.0-cil
And off it went!

Issues with running nunit-console.exe with Mono

I could make a dll for NUnit NUnit test under mono, but when I tried to run in with nunit-console.exe I get the following error message.
Runtime Environment -
OS Version: Unix 10.3.0.0
CLR Version: 2.0.50727.1433 ( 2.6.4 (tarball Thu Apr 22 13:24:33 MDT 2010) )
ProcessModel: Default DomainUsage: Single
Execution Runtime: mono-2.0
** (/Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/nunit-console.exe:36800): WARNING **: The following assembly referenced from /private/var/folders/m4/m4u1hmP+FHOQaiZbHj1UCk+++TI/-Tmp-/nunit20/ShadowCopyCache/36800_634111616836311880/Tests_-22323139/assembly/shadow/54274fc2/118e035c_45a94c9e_00000001/mut.dll could not be loaded:
Assembly: nunit.framework (assemblyref_index=1)
Version: 2.5.5.10112
Public Key: 96d09a1eb7f44a77
System error: Invalid argument
** (/Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/nunit-console.exe:36800): WARNING **: Could not load file or assembly 'nunit.framework, Version=2.5.5.10112, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies.
What might be wrong? I have nunit.framework.dll under /Users/smcho/bin/NUnit-2.5.5.10112/bin/net-2.0/framework, but it doesn't seem to know about this.
This is another frustrating point about using NUnit in Mono. As far as I've been able to tell, you need to have all of those missing files (there will be more than just nunit.framework.dll) in the same directory as nunit-console.exe.
There might be a command line option either in mono or nunit-console.exe to specify another directory to search for missing DLLs -- I'm not sure. Barring that, you'll have to copy the missing DLLs into the same folder as nunit-console.exe, or you'll have to cd into the framework folder and use mono ../nunit-console.exe /path/to/my/tests.dll
Once nuget is installed, you can use it to install nunit.console like so:
(This is from my .circlci/config.yml file)
- run: mono --runtime=v4.0 nuget.exe install nunit.console
- run: msbuild MySolution.sln
- run: mono --runtime=v4.0 NUnit.ConsoleRunner.3.12.0/tools/nunit3-console.exe FirstModule.Tests/bin/Debug/FirstModule.Tests.dll
- run: mono --runtime=v4.0 NUnit.ConsoleRunner.3.12.0/tools/nunit3-console.exe SecondModule.Tests/bin/Debug/SecondModule.Tests.dll
The trick is to specify the entire path for the NUnit.ConsoleRunner and to watchout for the - changing into a . by version 3