5

I am trying to create an application in MonoDevelop 4.2.3 using assemblies I created with Visual Studio for .NET 4.5, but I get this warning:

/usr/lib/mono/4.5/Microsoft.Common.targets: Warning: Reference 'System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' not resolved (ListenerBinTest)

And of course, it fails with this error when I try to run the app:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  at System.Threading.Tasks.Dataflow.TransformBlock`2[System.Net.Sockets.Socket,vtortola.WebSockets.WebSocketListener+WebSocketNegotiationResult]..ctor (System.Func`2 transform, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions dataflowBlockOptions) [0x00000] in <filename unknown>:0
  at vtortola.WebSockets.WebSocketListener..ctor (System.Net.IPEndPoint endpoint, vtortola.WebSockets.WebSocketListenerOptions options) [0x00000] in <filename unknown>:0
  at vtortola.WebSockets.WebSocketListener..ctor (System.Net.IPEndPoint endpoint) [0x00000] in <filename unknown>:0
  at ListenerBinTest.MainClass.Main (System.String[] args) [0x00010] in /home/vtortola/ListenerBinTest/ListenerBinTest/Program.cs:12

To be honest, I do not use anything related with System.Diagnostics.Tracing, but apparently System.Threading.Tasks.Dataflow does.

This is my setup:

=== MonoDevelop ===
Version 4.2.3
Installation UUID: 2798c094-3f0b-42d7-afe4-2984107bea4e
Runtime:
    Mono 3.2.8 (tarball Mon Mar 10 19:20:49 UTC 2014) (64-bit)
    GTK+ 2.24.22 theme: oxygen-gtk
    GTK# (2.12.0.0)

=== Build Information ===
Git revision:
Build date: 2014-03-10 20:43:25+0000

=== Operating System ===
Linux
Linux linux-nt8h.site 3.11.10-7-desktop #1 SMP PREEMPT Mon Feb 3 09:41:24 UTC 2014 (750023e) x86_64 x86_64 x86_64 GNU/Linux

How may I solve this problem?

Thanks.

vtortola
  • 34,709
  • 29
  • 161
  • 263

1 Answers1

5

Unfortunately Mono 3.2.8 does not have the System.Diagnostics.Tracing.dll as part of its full .NET framework implementation.

However should be able to workaround this by copying the PCL version of the System.Diagnostics.Tracing.dll into your project and referencing that. This assumes you are not actually using any of the System.Diagnostics.Tracing.dll in your project since the PCL library may not have any implementation.

With Mono 3.4.0 installed you can copy one of the System.Diagnostics.Tracing.dll files. To test everything worked I copied the following file into my project:

/Library/Frameworks/Mono.framework/Versions/3.4.0/lib/mono/xbuild-frameworks/.NETPortable/v4.5/System.Diagnostics.Tracing.dll

This is on the Mac. You will need to find the file since the location will be different on Linux and it may be in different location in Mono 3.2.8. It seems to be in Profile7 which should be included with Mono 3.2.8. The .dll is also available from Microsoft in the Portable Library Reference Assemblies download. Unfortunately that download requires Windows to be able to install a .zip file with the portable library dlls.

The file was copied into the project since you cannot browse to it with Xamarin Studio whilst adding a reference. This is because it is in a directory that is hidden because the directory starts with a dot.

Directly referencing the System.Diagnostics.Tracing.dll in my project I could get Microsoft's example DataFlow code working.

Matt Ward
  • 47,057
  • 5
  • 93
  • 94
  • Thanks a lot, but unfortunately it didn't work. I installed that Portable Library Reference in a windows Machine, get the libraries, and add the file you mentioned, and now I get two warnings instead one. The first just says "/usr/lib/mono/4.5/Microsoft.Common.targets: Warning: Reference 'System.Diagnostics.Tracing' not resolved (ListenerBinTest)", and the second one is the same I put before. And when I run it, I get the same error than before. – vtortola May 11 '14 at 12:58
  • Where can I get mono 3.4? only from sources? (links in the mono-project page gets you 3.2.3, not 3.4.0 as the download page intended) – vtortola May 11 '14 at 13:00
  • I think there is only a binary release for Mono 3.4 on the Mac. As far as I am aware Mono 3.4 ships the same binaries that Microsoft provides in that download so they should work. I will test it on a Linux machine. – Matt Ward May 11 '14 at 15:11
  • 1
    Tried this on OpenSuse 12.3 with Mono 3.2.3 and MonoDevelop 4.0.12 and it seems to work. I copied the v4.5/System.Diagnostics.Tracing.dll file from Microsoft's zip file to the Linux machine. Created a C# console application, switched it to be .NET 4.5, added the Tpl DataFlow NuGet package, copied the code from the example on Microsoft's website. Running it straight away fails with the assembly not found before the tracing PCL assembly is referenced. Then after adding a reference to System.Diagnostics.Tracing.dll and the application runs without any errors. – Matt Ward May 11 '14 at 16:14
  • I was using the dataflow library from Windows. I installed NuGet in MonoDevelop and then included dataflow, and now there is no warnings and it seems to run. I am checking now if it works properly... – vtortola May 11 '14 at 17:59