CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Forum has moved

New location: CSLA .NET forum


CSLA .NET Resources:
  • CSLA .NET forum
  • CSLA .NET home page
  • CSLA 4.5 DataPortalT.cs

    rated by 0 users
    Answered (Verified) This post has 1 verified answer | 4 Replies | 1 Follower

    Top 25 Contributor
    498 Posts
    Tiago Freitas Leal posted on Thu, Aug 30 2012 6:27 PM

    Hi Rocky,

    I was having a look at  CSLA (Trunk 4.5.1.0) and VS2012 refuses to compile both Csla.Net4 and Csla.Silverlight (SL5) projects on the grounds:

    'System.Threading.Tasks.Task' does not contain a definition for 'Run'

    It's the only error I got on both projects.

    Microsoft.CompilerServices.AsyncTargetingPack 1.0.0 is installed. Microsoft.CompilerServices.AsyncTargetingPack.Net4 and Microsoft.CompilerServices.AsyncTargetingPack.Silverlight5 references are all right.

    It's a Windows 7 Pro system, fully updated.

    After some investigation, I added a NET45 symbol to the Csla project and changed the offending line as follows:

    #if NET45
      return Task.Run(() => dp.DoFetchAsync(objectType, criteria, true)).Result;
    #else
      return TaskEx.Run(() => dp.DoFetchAsync(objectType, criteria, true)).Result;
    #endif

    Everything builds. Don't know if it runs :)

    Tiago Freitas Leal, CslaGenFork (Open Source CSLA code generator)

    Answered (Verified) Verified Answer

    Top 10 Contributor
    2,279 Posts
    Verified by Tiago Freitas Leal

    Mmmm,  must something that is added lately in the code that breaks the SL5 and .NET 4 projects.

    So, yes - you are correct. We need to add compiler directives if this is the way to go.

    I believe Rocky has been trying to find a way to make the sync portal use the async methods internally..
    Just not sure if it is all working as it should yet.

    Jonny Bekkum, Norway CslaContrib Coordinator

    All Replies

    Top 10 Contributor
    2,279 Posts
    JonnyBee replied on Thu, Aug 30 2012 10:32 PM

    Hi,

    Seems like you have the AsyncCTP installed (TaskEx) and not the latest AsyncTargetingPack.

    I run on Windows 7 Pro with VS2012 Premium and AsyncTargetingPack.

    Use NuGet to install the targeting pack into these projects.
    Install-Package Microsoft.CompilerServices.AsyncTargetingPack

    Jonny Bekkum, Norway CslaContrib Coordinator

    Top 25 Contributor
    498 Posts

    Hi Jonny,

    Been there done that. Today I repeated the steps Uninstall-Package / Install-Package several times . Even cleared the proxy cache.

    As a side note, since both the reference and the DLL were already there, the Install-Package operation made no changes. I must conclude this wasn't needed at all. Every now and again some guys at Microsoft come up with some brilliant ideas. This is a simple DLL and it should be possible to add a reference as we do for every other DLL. Forcing us to use the package manager to add a reference to a project is really brilliantly convoluted. I guess they won the 2012 Olympics gold medal for the most convoluted idea.

    Back to the trunk sources, if you take a look at

    Microsoft.CompilerServices.AsyncTargetingPack.Net4.xml

    that is in

    ...\Source\packages\Microsoft.CompilerServices.AsyncTargetingPack.1.0.0\lib\net40

    you will notice that around line 1778 TaskEx shows up. The respective DLL seems to know TaskEx also.

    So... I feel confused. Any ideas?

    Tiago Freitas Leal, CslaGenFork (Open Source CSLA code generator)

    Top 10 Contributor
    2,279 Posts
    Verified by Tiago Freitas Leal

    Mmmm,  must something that is added lately in the code that breaks the SL5 and .NET 4 projects.

    So, yes - you are correct. We need to add compiler directives if this is the way to go.

    I believe Rocky has been trying to find a way to make the sync portal use the async methods internally..
    Just not sure if it is all working as it should yet.

    Jonny Bekkum, Norway CslaContrib Coordinator

    Top 25 Contributor
    498 Posts

    I just wish to add that, since CSLA sources include the DLL and XML files, there is no need to install anything at all. Just tested with a fresh project.

    Tiago Freitas Leal, CslaGenFork (Open Source CSLA code generator)

    Page 1 of 1 (5 items) | RSS

    Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
    Email admin@lhotka.net for support.
    Powered by Community Server (Non-Commercial Edition), by Telligent Systems