Git Product home page Git Product logo

corewf's Introduction

Build Status

CoreWF

A port of the Windows Workflow Foundation (WF) runtime to .NET 6. It is licensed under the MIT License.

This is not an official Microsoft release of WF on .NET 6. CoreWF is a derivative work of Microsoft's copyrighted Windows Workflow Foundation.

WF Overview

Workflows are multi-step processes composed of activities. Activities are single-purpose elements that can be composed of other activities. Workflows have only one root activity in the same way that an XML document has only one root element.

Developers can create workflows in code:

var helloWorldActivity = new Sequence()
{
    Activities =
    {
        new WriteLine
        {
            Text = "Hello World!"
        }
    }
};

The workflow can be run with the following code:

System.Activities.WorkflowInvoker.Invoke(helloWorldActivity);

The similarity of workflow/activity concepts to XML's document/element concepts means it's possible to write workflows in XML; specifically, an extension of XML called XAML . The "Hello World!" workflow from above can be written as:

<Activity 
 x:Class="WorkflowConsoleApplication1.HelloWorld"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Sequence>
    <WriteLine Text="Hello World!" />
  </Sequence>
</Activity>

The XAML workflow can be loaded in CoreWF through ActivityXamlServices:

var helloWorldActivity = ActivityXamlServices.Load(new StringReader(xamlString));
System.Activities.WorkflowInvoker.Invoke(helloWorldActivity);

WF in the .NET Framework includes a visual, drag-and-drop designer for workflows that produces XAML. The "Hello World!" workflow looks like this in the designer:

Hello World! workflow in WF designer

The designer experience is not part of CoreWF but the XAML produced by the designer can be run in CoreWF (with some limitations). The WF designer experience is available in Visual Studio 2019 by enabling the "Windows Workflow Foundation" individual component in the Visual Studio Installer.

Target Frameworks

CoreWF targets .NET 6 and .NET 6 Windows. The .NET Windows target uses the System.Xaml included in the .NET Desktop Runtime. To use CoreWF on non-Windows runtimes, use the portable .NET 6 target. This is possible because CoreWF includes a copy of the System.Xaml code.

Usage

To add this library to your project, use the NuGet package.

Debug using Source Link

Preview builds setup

MyGet (dev)

Contributing

Check out the contributing guide for information on how to help CoreWF.

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

.NET Foundation

This project is supported by the .NET Foundation.

corewf's People

Contributors

alexmustata19 avatar alvinstanescu avatar andreeadumitru avatar andrei-ungureanu-uipath avatar andreisingeorzan avatar andreitimisescu avatar aoltean16 avatar cosminsandu25 avatar david-barzi avatar dependabot[bot] avatar dmetzgar avatar ewinnington avatar foxtrek64 avatar gabriela-lungu-uip avatar gabrielavaduva avatar gerardcieciwa avatar github-jane-doe avatar gpanaitescu avatar laviniac avatar lbargaoanu avatar liviu-seniuc avatar liviu-uba avatar marius-bughiu avatar mihainradu avatar mirceaarhip avatar patrykgz avatar pawelpopielarski avatar valpiele avatar vlad-zuga avatar vuplea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

corewf's Issues

Content element not working

When using a XAML like the following:

<Activity x:Class=""WFTemplate""
          xmlns=""http://schemas.microsoft.com/netfx/2009/xaml/activities""
          xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"">
  <Sequence>
    <WriteLine>
      <Content>
        <Text>""HelloWorld""</Text>
      </Content>
    </WriteLine>
  </Sequence>
</Activity>

I get this exception:

Result Message:	Portable.Xaml.XamlObjectWriterException : The value  for 'Text' property is null
Result StackTrace:	
at Portable.Xaml.XamlObjectWriterInternal.OnWriteGetObject()
   at Portable.Xaml.XamlWriterInternalBase.WriteGetObject()
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at CoreWf.XamlIntegration.FuncFactory`1.Evaluate() in C:\dev\corewf\src\CoreWf\XamlIntegration\FuncFactory.cs:line 91
   at CoreWf.DynamicActivity.OnInternalCacheMetadata(Boolean createEmptyBindings) in C:\dev\corewf\src\CoreWf\DynamicActivity.cs:line 122
   at CoreWf.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1& validationErrors) in C:\dev\corewf\src\CoreWf\Activity.cs:line 1074
   at CoreWf.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack`1& activitiesRemaining, ActivityCallStack parentChain, IList`1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback) in C:\dev\corewf\src\CoreWf\ActivityUtilities.cs:line 647
   at CoreWf.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors) in C:\dev\corewf\src\CoreWf\ActivityUtilities.cs:line 910
   at CoreWf.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors) in C:\dev\corewf\src\CoreWf\ActivityUtilities.cs:line 826
   at CoreWf.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager) in C:\dev\corewf\src\CoreWf\Hosting\WorkflowInstance.cs:line 376
   at CoreWf.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager extensionManager) in C:\dev\corewf\src\CoreWf\Hosting\WorkflowInstance.cs:line 182
   at CoreWf.WorkflowApplication.EnsureInitialized() in C:\dev\corewf\src\CoreWf\WorkflowApplication.cs:line 611
   at CoreWf.WorkflowApplication.RunInstance(WorkflowApplication instance) in C:\dev\corewf\src\CoreWf\WorkflowApplication.cs:line 1215
   at CoreWf.WorkflowApplication.Invoke(Activity activity, IDictionary`2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout) in C:\dev\corewf\src\CoreWf\WorkflowApplication.cs:line 1245
   at CoreWf.WorkflowInvoker.Invoke(Activity workflow, TimeSpan timeout, WorkflowInstanceExtensionManager extensions) in C:\dev\corewf\src\CoreWf\WorkflowInvoker.cs:line 298
   at CoreWf.WorkflowInvoker.Invoke(Activity workflow, TimeSpan timeout) in C:\dev\corewf\src\CoreWf\WorkflowInvoker.cs:line 87
   at CoreWf.WorkflowInvoker.Invoke(Activity workflow) in C:\dev\corewf\src\CoreWf\WorkflowInvoker.cs:line 81
   at XamlTestCases.XamlTests.XamlWorkflowNoInputs(String xamlString) in C:\dev\corewf\src\XamlTestCases\XamlTests.cs:line 92

The Content element must not be setting the value of the Text property on WriteLine. Need to investigate why not.

Question

The last change was three months ago and there has not been any activity since, best I can tell. So, if we are planning to move to .NET Core, should we write off Workflow Foundation altogether?

Nuget release

Will you be building a Nuget available somewhere so that people can directly include corewf in .net core apps?

Created a local nuget feed to consume it.

And thank you for this!

Port remaining WF tests

A lot of tests were left out because the features weren't implemented. Those tests can be ported and then disabled. As features are added, we can enable their tests.

Automatic CacheMetadata

This should either be replaced with a reflection-based implementation or use the System.ComponentModel pieces from the .NET Standard 2.0.

Use XmlnsDefinition attributes instead of explicit CLR namespaces

This is in reference to an issue with Portable.Xaml: cwensley/Portable.Xaml#105

Portable.Xaml isn't paying attention to the XmlnsDefinitionAttribute in a referenced assembly. WF uses these pretty heavily. Even when the attributes are copied into the test assembly's AssemblyInfo.cs, they're still not recognized.

The tests are temporarily getting around this by using CLR namespaces. But that will be a blocker for migrating from .NET Framework WF to CoreWF.

Upgrade to MSBuild

This project still uses the old project.json system. Upgrade to csproj.

Use Microsoft.Extensions.Localization instead of resxcodefilegenerator

In the traditional build path in the .NET Framework, we have a tool called resxcodefilegenerator that turns a resx file into a cs file. Developers can then reference use properties to reference the various resource strings instead of calling ResourceManager directly. A new library introduced with .NET Core called Microsoft.Extensions.Localization includes the IStringLocalizer. The default language can be used as keys directly in the code since it will use the key if there is no resource string to be found for that culture. This also makes it easier to find where a particular error message comes from in the code.

Suggestion: C# expression parsing

As I understand from readme file you need a c# expression parser to complete WWF this implementation. I have one. I could 'clean' it from unrelated stuff and constricting licensing. If you specify an contract/interface to implement and location/folder where this code should be I would provide PR.

Use OmniXAML

Have you considered using OmniXAML?

Have read that in the past it didn't support x:Class that was needed for WF, but now it does (in v2):
OmniGUI/OmniXAML#12

Support xml serialization

Microsoft is backing out of Newtonsoft JSON package in favor of it's own implementation. If we were to serialize the InstanceStore without depending on Newtonsoft to deep serialize object type to be able to later deseralize it, two changes to code should be made:

  • ActivityInstance
[DataContact(IsReference = true)]
  • InstanceValue
[KnownType(typeof(ActivityExecutor))]
    [KnownType(typeof(Variable<int>.VariableLocation))]
    [KnownType(typeof(Variable<string>.VariableLocation))]

Having done these we can use DataContractSerializer.WriteObject(), resulting in an xml we may persist.

Persist a completed wf after resuming fails

Due to changes made during last couple of months. Prior to that, it used to work. The PersistableIdle fails if returns PersistableIdleAction.Persist when reaching end of flow.

Porting Workflow Designer to .NET Core 3

As .NET Core 3 supports WPF, so I want to make experiments to port the Workflow Designer.
Where can I find the source code and unit tests of these dlls:
System.Activities.Presentation
System.Activities.Core.Presentation
Thank you.

Port SQL Workflow Instance Store

SWIS implements the InstanceStore abstract class and uses the client for SQL Server. It should be a straightforward port to .NET Standard.

Split WriteLine activity into separate package

Console writing is not included in all forms of the .NET standard. The WriteLine activity includes a default to write to the console. Separating it to its own package would allow us to support a lower .NET standard and be available to more platforms.

Move from resx to restext

Resx files allow you to include other things such as images into your localized resources. That's not necessary for a library like WF. The resx format is a clunky, old XML format that was intended to be edited with a tool. Restext, however, is much easier to read and less verbose.

Add Transactions support

System.Transactions is part of .NET Core 2.0. It only supports local transactions, but that should be enough for some workflow scenarios.

CSharpValue and CSharpReference are not fully functional yet

When working on Xaml workflows generated by visual studio with CSharpValue and CSharpReference elements, I get a Workflow not compiled error even after setting compilation to true in the settings.

I’ll try and resolve this down to a simple test case, the WF I built was too ambitious.

Has anyone else managed to use a Visual Studio defined Xaml Workflow?

Also with the assembly name change, you have to change the Xaml declaration at the beginning of the Xaml to make it work.

This is related to my testing this in my wfRunnerCore repo.

Related to #7

Load and edit workflows in .NET Framework Designer

Hallo

in our company we use .NET Framework Rehosted Workflow Designer to create and edit workflows.
Actually we use it only on windows machines. But we want to switch to .NET Standard to also able to use Linux machines.

Creating and executing activities with CoreWF works perfect acutally. But we need the ability to create and edit workflows with .NET rehosted workflow designer.

When I try to load a workflow file into the designer I will get a message that the contextproperty is not set.
The workflow file was created by CoreWF (and Portable.Xaml).

Is there a change to get it work ?

Thanks in advance!

Create a BPML to WF converter

BPML is an industry standard for workflow definitions. If we have something that can read BPML, then we may not need to create a WF workflow designer.

FileInstanceStore Error...

I try to run FileInstanceStore Samples Project (BookmarkConsoleApp) and I encounter an error in the LoadWorkflow function.

{"Could not convert string 'e0f9ec98-30a2-4641-b760-5abcbb2fa5bb' to dictionary key type 'CoreWf.Bookmark'. Create a TypeConverter to convert from the string to the key type object. Path 'Value.bookmarkMgr.bookmarks.e0f9ec98-30a2-4641-b760-5abcbb2fa5bb', line 12, position 47."} | Newtonsoft.Json.JsonSerializationException

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.