Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 740939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:34:28+00:00 2026-05-14T08:34:28+00:00

Assume that I have a .NET Workflow Foundation (WF) SequenceActivity class with the following

  • 0

Assume that I have a .NET Workflow Foundation (WF) SequenceActivity class with the following “output” property:

public IWorkspace Workspace { get; private set; }
//     ^^^^^^^^^^
//     important: this is a COM interface type!

public static DependencyProperty WorkspaceProperty = DependencyProperty.Register(
        "Workspace",
        typeof(IWorkspace),
        typeof(FoobarActivity));   // <-- this activity class

This activity executes some code that sets both of the above like this:

this.Workspace = ...;   // exact code not relevant; property set to a COM object
SetValue(WorkspaceProperty, this.Workspace);

The last line (which makes the call to SetValue) results in an ArgumentException for the second parameter (having the value of this.Workspace):

Type […].IWorkspace of dependency property Workspace does not match the value’s type System.__ComObject.
                                          (translated from German, the English exception text might differ slightly)

As soon as I register the dependency property with typeof(object) instead of typeof(IWorkspace) as the second parameter, the code executes just fine. However, that would result in the possibility to assign just about any value to the dependency property, and I do not want that.

It seems to me that WF dependency properties don’t work for COM interop objects.
Does anyone have a solution to this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:34:28+00:00Added an answer on May 14, 2026 at 8:34 am

    To give a first answer to my own question, I found this work-around to work:

    If the COM object is wrapped in a .NET object, Workflow Foundation will be able to deal with it.


    (1) First define a generic helper class:

    public class Wrapped<T>
    {
        T Value { get; set; }
    
        public Wrapped(T init)
        {
            Value = init;
        }
    }
    

    (2) Then, change the above activity property definitions to:

    public Wrapped<IWorkspace> Workspace { get; private set; }
    //     ^^^^^^^^^^^^^^^^^^^
    //     this is now a .NET class type wrapping a COM object instance.
    
    public static DependencyProperty WorkspaceProperty = DependencyProperty.Register(
            "Workspace",
            typeof(Wrapped<IWorkspace>),
            typeof(FoobarActivity));
    

    (3) Finally, the assignment to the Workspace property now becomes:

    this.Workspace = new Wrapped<IWorkspace>(...);
    

    While this works just fine, it’s still only a workaround.
    If someone has a more elegant solution, I’d love to hear about it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On ASP.NET MVC 3, assume that we have following controller action: public ActionResult Index()
Assume that we have the following code: class Program { static volatile bool flag1;
First hi and thanks in advance in ASP.NET : assume that i have a
I am writing a web application on Asp.Net MVC 3. Assume that we have
Assume I have an ASP.NET MVC app that's not doing anything too fancy (no
Assume that I have three class; UserAccount, UserGroup and Role. UserGroup and Role are
Assume that you have this code in C#/.NET (using PostgreSQL via ODBC): using System.Data.Odbc;
Assume that we have a network deployed desktop application written in .NET. We don't
Assume that you have the following operation: void AddCustomer(Customer) (i.e. a Customer object as
Assume that we have N erlang nodes, running same application. I want to share

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.