views:

186

answers:

1

I am creating a very simple state machine class library project in vb.net. This has only 3 states - CreateApplication, ProcessApplication and CompleteApplication. I have an interface created in the same project.I am invoking it from a web application by calling ApplicationService.CreateApplication(obj of ApplicationDetail)

 <ExternalDataExchange()> _
    Public Interface IApplicationService
        Event ApplicationCreated As EventHandler(Of ApplicationDetailEventArgs)
        Event ApplicationProcessed As EventHandler(Of ApplicationDetailEventArgs)
    End Interface

I also have its implementation in ApplicationService.vb

 Public Class ApplicationService
        Implements IApplicationService

        Public Event ApplicationCreated(ByVal sender As Object, ByVal e As ApplicationDetailEventArgs) Implements IApplicationService.ApplicationCreated

        Public Event ApplicationProcessed(ByVal sender As Object, ByVal e As ApplicationDetailEventArgs) Implements IApplicationService.ApplicationProcessed

        Public Shared Sub CreateApplication(ByVal objApplicationDetail As ApplicationDetail)
            Using workflowRuntime As New WorkflowRuntime()
                AddHandler workflowRuntime.WorkflowCompleted, AddressOf OnWorkflowCompleted
                AddHandler workflowRuntime.WorkflowTerminated, AddressOf OnWorkflowTerminated

                Dim workflowInstance As WorkflowInstance
                workflowInstance = workflowRuntime.CreateWorkflow(GetType(Workflow1))
                workflowInstance.Start()
            End Using
            'Code to create application
        End Sub

        Shared Sub OnWorkflowCompleted(ByVal sender As Object, ByVal e As WorkflowCompletedEventArgs)
        End Sub

        Shared Sub OnWorkflowTerminated(ByVal sender As Object, ByVal e As WorkflowTerminatedEventArgs)
        End Sub

    End Class

My issueis that, when I try to run it I am getting the value of workflowInstance . InstanceId as Empty.

I have been trying to fix this since the last 2 days. Can someone please help.

Thanks in advance!

A: 

Well..I was able to figure out what the problem was. It has nothing to do with workflow. It is a bug in Visual Studio(2005 and 2008). When you debug in VB.Net, the value of a Guid shows up as empty, but if you use Guid.ToString..it works fine. This does work correctly in C#.

AgentHunt