none
Failed to use DataFlow in production

    Question

  • 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.


    vendredi 27 avril 2012 09:24

Réponses

  • 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...

    • Marqué comme réponse Eitan Revach vendredi 27 avril 2012 11:38
    vendredi 27 avril 2012 11:38

Toutes les réponses

  • 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?

    vendredi 27 avril 2012 10:26
    Propriétaire
  • 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.

    vendredi 27 avril 2012 11:06
  • an 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
    vendredi 27 avril 2012 11:12
  • 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:True

    in 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'.

    vendredi 27 avril 2012 11:24
  • 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...

    • Marqué comme réponse Eitan Revach vendredi 27 avril 2012 11:38
    vendredi 27 avril 2012 11:38