Print Page | Close Window

Coroutine in VB.NET problem

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2624
Printed Date: 29-Jul-2026 at 8:30pm


Topic: Coroutine in VB.NET problem
Posted By: THWI
Subject: Coroutine in VB.NET problem
Date Posted: 20-Apr-2011 at 12:39am
 
Has implemented exactly as described, but get this error:
 
Error 3 Overload resolution failed because no accessible 'Start' can be called without a narrowing conversion:
 'Public Shared Function Start(
  coroutine As System.Func(Of System.Collections.Generic.IEnumerable(Of IdeaBlade.EntityModel.INotifyCompleted)),
  [completedHandler As System.Action(Of IdeaBlade.EntityModel.CoroutineOperation) = Nothing])
  As IdeaBlade.EntityModel.CoroutineOperation':
  Argument matching parameter 'coroutine' narrows
   from 'System.Collections.Generic.IEnumerable(Of System.Func(Of IdeaBlade.EntityModel.INotifyCompleted))'
   to   'System.Func(Of System.Collections.Generic.IEnumerable(Of IdeaBlade.EntityModel.INotifyCompleted))'. 
 
MY CODE IS AS FOLLOWS:
Can someone tell me whats wrong.
 
Function LoadAll(ByVal manager As myEntityManager) As IEnumerable(Of Func(Of INotifyCompleted))
 
' List of asynchronous functions for the Coroutine to execute serially
Dim funcList = New List(Of Func(Of INotifyCompleted))
 
' Get all
Dim loadFnc As Func(Of INotifyCompleted) = _
Function()
    Return manager.Customers.ExecuteAsync() ' return an INotifyCompleted
End Function
 
funcList.Add(loadFnc)
 
' return the list
Return funcList
 
End Function
 
 
 
' Sequence from my main routine
 
Dim op = Coroutine.Start(LoadAll(_eMgr))
AddHandler op.Completed, _
  Sub(s As Object, e As CoroutineCompletedEventArgs)
    If e.CompletedSuccessfully Then
      Debug.Write("All were loaded")
    Else
      Debug.Write(e.Error.Message)
    End If
  End sub



Replies:
Posted By: sbelini
Date Posted: 21-Apr-2011 at 11:51am

 Hi THWI,

The snippet you provided looks ok.
It also executes without problems here.
Here's a simple solution with your snippet where everything works fine: http://www.ideablade.com/forum/uploads/892/VBCoroutine.zip - uploads/892/VBCoroutine.zip
 
Are you getting this error during compilation or at runtime? What version of DevForce are you running?
 
Can you upload a simple solution reproducing the issue?
 
Silvio.


Posted By: THWI
Date Posted: 26-Apr-2011 at 1:04am
Hi Silvio and many thanks for your reply.
 
As you tell me that the code snippet compiles ok at your computer, I checked out my version of DevForce.
My version is 6.0.8, and I suppose I will need 6.0.9 which contains additional overloads of Croutine.Start.
 
Regards THWI.


Posted By: sbelini
Date Posted: 26-Apr-2011 at 1:17pm
Hi THWI,
 
So, the errors you were getting are in fact compilation errors?
I did test with DeVForce6.0.9.
Did upgrading to 6.0.9 solved your issue?
 
Regards,
   Silvio.


Posted By: THWI
Date Posted: 26-Apr-2011 at 1:27pm
Hi Silvio,

Once again thank you for your engagement.
Upgrade to 6.0.9 did solve my problem with the
Coroutine.Start.

Regards Thorbjørn



Print Page | Close Window