.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid
Post New Web Links

Bug - Cannot initialize 'StateMachineWorkflowActivity' that does not define a valid 'InitialState

Posted By:      Posted Date: October 09, 2010    Points: 0   Category :WPF

Hello everyone,


I'm actually encountering this problem, i get the "Cannot initialize 'StateMachineWorkflowActivity' that does not define a valid 'InitialStateName' property." error on the line :

WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(WorkflowUtexbel));

I know it already has been discussed but since i couldn't find a solution to this bug, i'm posting.

I triple-checked EVERYTHING :

* The project file has the correct projecttypeguid tags for WF ;

* The namespaces are OK everywhere in the software

* The workflow files (layout, .cs and .xoml) have the correct references to the workflow name (and full qualified when necessary in the .xoml file)

* Everything in the workflow layout is OK

* A valid initial state is set

* I'm using .NET framework 3.5 + SP1,  and Visual Studio 2008

* All the references to the WF are added to my project

* I already could get a workflow working in another project on the same machine but had the same problem when i had to rename my namespace, i think i had to recreate completely the workflow because just modifying the tags in the files didnt fix anything. I already recreated completely the workflow in my project (deleting the previous one), nothing changes, it's still not working.



View Complete Post

More Related Resource Links

Cannot initialize 'StateMachineWorkflowActivity' that does not define a valid 'InitialStateName'


I'm getting this error while creating workflow.

WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(typeof(MyWorkflow));

 I checked on the other forums and also I confirmed that build action of my .xoml file is content and .layout and .rules file is embedded resource. i have downloaded the latest extention of WF from this location and installed it. http://www.microsoft.com/downloads/details.aspx?FamilyId=A2151993-991D-4F58-A707-5883FF4C1DC2.


I have also confirmed that x:class attribute has fully qualified class name of my workflow.


Error is raised at this paticular location after initializing all the private class level variable.

public BaseEventArgs m_BaseEventArgs = default(BaseEventArgs);


This is the last class level variable to be initialized.


Please help.


Thanks in advance.


Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

ReportViewer :: Failed to enable constraints. But my statement is valid!!

  • A
  • n error has occurred during report processing.
      • Exception has been thrown by the target of an invocation.
        • Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    Why do I keep getting this error, even when not using any data on the report. When I run the query in SQL server I get a resultset. However when I try to render the report I get this error.


    Path not valid.



    im trying to save a file, filename as current date and time.it will give an error.

    any ideas.

    here is my code

    string datetime=DateTime.Now.ToString();

    if (GridviewtoCSV("~/Admin/doc/Reports/" + batchid.ToString() + datetime + ".csv", transactiongrid) && GridviewtoPDF("~/Admin/doc/Reports/" + batchid.ToString() + datetime + ".pdf", transactiongrid))

    MVC3: Define Dynamic ViewModel property inside Action Filter



    How can I define a Dynamic ViewModel property in MVC 3 inside an action filter?

    I am looking to have something like but inside the ActionFilter and not in the controller:

    ViewModel.Title = "Home";

    Thank You,


    Conversion from string to type 'Date' is not valid



    Im receiving a strange error Error Message: Conversion from string "15/08/2010 22:21:35" to type 'Date' is not valid.

    I know this is generally down to cultural date formats etc, however the reason this is strange is it just randomly occured twice in the last week, the website has been running since october and nothing has changed,

    The error constantly occured until the IIS was reset and recompilled the site, its been running fine since, however im just trying to figure out what could cause such an error to occur.

    I've narrowed it down to a line of code which is:

    bktime = DReader.Item("Bktime").ToString

    bktime = Year(CDate(bktime)) & "-" & fmt(Month(CDate(bktime)), 2) & "-" & fmt(Day(CDate(bktime)), 2)

    Has anyone else encountered this randomly occuring and is there anything i can put in place to prevent this in future?



    override error message (The value 'test' is not valid for Age) when input incorrect data type for in


    Hello everyone,

    I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

    public class Person
    public string FirstName {get;set;}
    public int Age {get;set;}


    For view, I put text input for Age to get it value.

    When type some string in Age text box like 'test' and press submit button. I got this error message

    The value 'xxx' is not valid for Age

    However, I want to change this message and try many way. There 's nothing effect this message value.

    Please could you help me to solve this problem.

    report definition is not valid



    I recently upgraded to VS 2010.  One on of my reports I am getting the following error.  Can someone help?

    The report definition is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' which cannot be upgraded.

    Thank you.

    How to Solve Cross-thread operation not valid: Control " accessed from a thread other than the threa

    I have a thread... like Dim a As new Threading.Thread(Address Of generate) Dim WithEvents lst As New ListBox()   Form_Load() Me.Controls.Add(lst) lst.SetBounds(100,100,150,80) End Sub   Button1_Click() a.Start() End Sub   Sub generate() Dim i As Integer For i = 1 To 10 lst.Items.Add(i) Next End Sub   When i run this program it results in the above mentioned Exception - Cross-thread operation not valid: Control " accessed from a thread other than the thread it was created on." What is this actually? Why it has been thrown..? Kinda help me please..... Thanx in advance

    XmlSerializer - how to define class to not generate attributes in root element?

    Hi! I have simple class that I serialize to xml file: <?xml version="1.0" encoding="utf-8"?> <MyRootElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Area="East">   <Products>     <SalesProduct Taxable="true">       <Name>Sofa</Name>     </SalesProduct>     <Product>       <Name>Television</Name>     </Product>   </Products> </MyRootElement> I don`t want have in xml file attributes xmlns:xsi and xmlns:xsd. How can I define class to not have these two attributes in xml file? I tried use XmlRoot attribute but there is no control for these two attributes. They are always generated. Regards

    Initialize snapshot fro alternate location - multiple .bcp files for an article

    I have to replicate over 50GB of data over a slow network.  I did not use the option to initialize snapshot from database backup because the replication articles contain row filters.  If I do that, I'll have to run a lot of scripts to remove the data and other unnecessary database objects on the subscriber. Instead, I created a workaround.  On the publisher, I first create the actual push subscription to the target subscriber on the publication.  This subscription is set not to initialize from snapshot.  I then created a second push subscription on the same publication, but the subscriber is a random database on the publisher server.  This second subscription is a dummy subscription set to initialize from snapshot - the purpose is to generate the necessary snapshot files.  I then reinitialized all subscriptions and generate the new snapshot files. On the subscriber, an empty database is created with the same tables as the publisher database.  I created an identical publication on this empty database, and a dummy push subscription on the target subscriber.  The subscription is reinitialized, and the snapshot files on the empty database is created.  These dummy snapshot files are then overwritten with the actual snapshot files created on the publisher, and then I synchronize the the dummy subscriptions with the actual sn

    Inheriting from StateMachineWorkflowActivity?

    I'm implementing a number of state machine workflows which all have a number of properties and a top level EventDrivenActivity in common. My first approach was to implement the common features in a class inheriting from StateMachineWorkflowActivity and then inherit my workflows from this class. However, this doesn't seem to be supported; specifically: 1. During build, validation fails on my base class because I haven't specified an initial state or final state. I tried adding two empty states to get around this problem, which worked, but then 2. The designer in VS2008 duplicates the activities in my base class when designing my derived class and then complains that it has duplicate component names. For example, I have a state in my base class called RESERVED_INITIAL which is my dummy initial state; when I work with my derived class in the designer, the designer adds a state called RESERVED_INITIAL to the derived class, causing an error because there are now two components with the same name What I want to ask, then, is: 1. Is using inheritance in this sort of way supported, ie, can we create classes that sit between StateMachineWorkflowActivity and actual concrete workflows to factor out common features of those workflows? And if not, 2. Is there a better way to capture the commonality between a number of workflows in a solution? Thanks in advance

    System.InvalidOperationException: Instance operation is not valid on workflow runtime thread

    Am getting the exception related in the title of this article when using the StateMachineWorkflowInstance object to arbitarily set state in my workflow code; and am unsure why.  The code follows below:   500     Protected Overrides Function Execute(ByVal executionContext As System.Workflow.ComponentModel.ActivityExecutionContext) As System.Workflow.ComponentModel.ActivityExecutionStatus   501    502    506         Dim smwi As StateMachineWorkflowInstance = New StateMachineWorkflowInstance(StaticWFRuntime.LocalRuntime, Me.WorkflowInstanceId)   511    512         'set workflow-wide database connection string   513         _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString   518    519         Utility.LogEnabled()   520    521         Utility.FoaeaLogger.WriteEntry("Processing TracingApplication.Execute()....", EventLogEntryType.Information)   522         If StaticWFRuntime.LocalRuntime Is Nothing OrElse StaticWFRuntime.LocalRuntime.IsStarted = False Then   523             Utility.FoaeaLogger.WriteEntry("No static RuntimeService object exists!", EventLogEntryType.Warning)   524         End If   525    526         Return MyBase.Execute(executionContext)   527    528     End Function   796     Private Sub gotoState2_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs)   797    798        

    Validation(): Attribute 'Factory' is not a valid attribute of element 'ServiceHost'

    Hi, I'm using REST WCF3.5. In my .svc file, the Factory attribute is giving me Warning in the Visual Studio Team Suite saying "Validation(): Attribute 'Factory' is not a valid attribute of element 'ServiceHost'." <%@ ServiceHost Language="C#" Debug="true" Service="RestService" CodeBehind="~/App_Code/RestService.cs" Factory="AppServiceHostFactory" %> using System; using System.ServiceModel; using System.ServiceModel.Activation; using Microsoft.ServiceModel.Web; class AppServiceHostFactory : ServiceHostFactory {  protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)  {   WebServiceHost2 host = new WebServiceHost2(serviceType, true, baseAddresses);                 // Add the basic authenticator interceptor   host.Interceptors.Add(new BasicAuthenticationInterceptor(    System.Web.Security.Membership.Provider, "foo"));   return host;  } } I've added the reference as well & Everything works fine but I was wondering why am I getting this warning?? Thanks!  

    The application failed to initialize properly (0xc0000006)

    Hi, I have been trying to solve the above message when executing an application build with Microsoft Visual C# 2008 and Net Framework 3.5. I execute the application remotely on a cmd archive using \\server\share\app.exe The only acceptable solution I have found is http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/938b9bed-f317-4cca-9ec2-b6e8105f629b/ but it does not work. I executed the following command on the remote folder C:\Windows\Microsoft.NET\Framework\v2.XXXX\ caspol.exe -m -ag LocalIntranet_Zone -url file:\\server\Share\* FullTrust and it says ok, but it does not work neither. One thing to notice is that if running \\server\path\app.exe and change to \\server\path2\app.exe then it works!! Any advise? Many Thanks. Regards, Salva    

    Help with error "The AdomdDataReader object is not positioned at a valid row"

    I have a PerformancePoint grid from which users can drillthrough into records in the underlying cube.  The cube itself imposes no limit on the number of records returned by drillthrough.  The server has a limit of 10,000 drillthrough records.  The Analysis Services build is 10.0.2531.0  In any event, the drillthrough itself always works, but when the number of records is large (say, 6000 or so), users receive the following error when attempting to export the results to excel: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The AdomdDataReader object is not positioned at a valid row. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: The AdomdDataReader object is not positioned at a valid row.] Microsoft.AnalysisServices.AdomdClient.AdomdDataReader.InternalGetValue(Int32 ordinal) +423 Microsoft.AnalysisServices.AdomdClient.AdomdDataReader.GetString(Int32 ordinal) +7 Microsoft.PerformancePoint.Analytics.WebC

    DontSaveSensitive; Key not valid for use in specified state error

    I initially had my packages set to 'EncryptSensitivewithPassword' and usedthe config files.  My job executes fine.  But I noticed I was getting THE error "......Key not valid for use in specified state.....".  So, I change the protection level to 'DontSaveSensitive' , saved packaged ,build and re-imported it.  And I still get the same result. What am I doing wrong??   Package is on the same server where it was built. I have a package in production that executes without the error.  I made a change to the package (logging) in test and now it also encounters same error as the package referenced above.
    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend