Failed to use DataFlow in production
-
27 апреля 2012 г. 9:24
Hi!
I have tried to use DataFlow in production and found out that it's not able to run.
Here is the code that try to run: (very simple)
var ab = new ActionBlock<int>(delegate(int i) { //Compute(i); });
The result is:
Unhandled Exception: System.TypeLoadException: Could not load type 'System.Dia
ostics.Tracing.EventSource' from assembly 'mscorlib, Version=4.0.0.0, Culture=
utral, PublicKeyToken=b77a5c561934e089'.
at System.Threading.Tasks.Dataflow.ActionBlock`1..ctor(Delegate action, Exe
tionDataflowBlockOptions dataflowBlockOptions)
at System.Threading.Tasks.Dataflow.ActionBlock`1..ctor(Action`1 action)
at ******.Hosts.TempConsole.Program.Main(String[] args)I saw a differences in versions in mscorlib.dll file (looks like it's the problem).
My version (rnd machine):4.0.30319.17379
Production: 4.0.30319.1 (RTMRel.030319-0100)
some how the class EventSource it involved here. it's .NET 4.5 class and I can't understand how is this possible?
I have 2011 beta installed in the complier machine. I've started uninstall it.
Will update later if helped.
Thanks.
- Изменено Eitan Revach 27 апреля 2012 г. 10:11
Все ответы
-
27 апреля 2012 г. 10:26Владелец
Hi Eitan-
It sounds like you referenced the System.Threading.Tasks.Dataflow.dll from .NET 4.5 Beta when you built, and then tried to run on a machine with .NET 4 installed. Is your project a .NET 4.5 project or a .NET 4 project?
- Предложено в качестве ответа Stephen Toub - MSFTMicrosoft Employee, Owner 27 апреля 2012 г. 10:27
- Отменено предложение в качестве ответа Eitan Revach 27 апреля 2012 г. 11:28
-
27 апреля 2012 г. 11:06
nop..
The project is 4.0 (it's VS 2010).
And the project is referenced to C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Threading.Tasks.Dataflow.dll.
-
27 апреля 2012 г. 11:12an update - uninstalling the VS 2011 abd restart - didn't help! same error.
the file version of System.Threading.Tasks.Dataflow.dll is: 4.0.30319.17379 built by: FXBETAREL -
27 апреля 2012 г. 11:24
another instresting update:
I added the code:
Console.WriteLine("ActionBlock<int> assembly location:{0}", typeof(ActionBlock<int>).Assembly.Location); Console.WriteLine("GlobalAssemblyCache:{0}", typeof(ActionBlock<int>).Assembly.GlobalAssemblyCache);
in my machine:
ActionBlock<int> assembly location:C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Threading.Tasks.Dataflow\v4.0_4.0.0.0__b77a5c561934e089\System.Threading.Ta
sks.Dataflow.dll
GlobalAssemblyCache:Truein production:
ActionBlock<int> assembly location:C:\Program Files\HP\TrySetup\System.Threading.Tasks.Dataflow.dll
GlobalAssemblyCache:False
Could not load type 'System.Diagnostics.Tracing.EventSource' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. -
27 апреля 2012 г. 11:38
Found the issue:
referencing the file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Threading.Tasks.Dataflow.dll
caused the problem.
After changing the reference to C:\Program Files\Microsoft Corporation\TPL Dataflow\redist\System.Threading.Tasks.Dataflow.dll
all start working!!
the files are differnet in sizes and versions. what is that? both are for 4.0...
- Помечено в качестве ответа Eitan Revach 27 апреля 2012 г. 11:38

