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

  • Home
  • SEARCH
  • 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 75897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:35:17+00:00 2026-05-10T20:35:17+00:00

I have a class which has the following constructor public DelayCompositeDesigner(DelayComposite CompositeObject) { InitializeComponent();

  • 0

I have a class which has the following constructor

public DelayCompositeDesigner(DelayComposite CompositeObject) {     InitializeComponent();      compositeObject = CompositeObject;   } 

along with a default constructor with no parameters.

Next I’m trying to create an instance, but it only works without parameters:

var designer = Activator.CreateInstance(designerAttribute.Designer); 

This works just fine, but if I want to pass parameters it does not:

var designer = Activator.CreateInstance(designerAttribute.Designer, new DelayComposite(4)); 

This results in an MissingMethodException:

Constructor voor type Vialis.LightLink.Controller.Scenarios.Composites.DelayCompositeDesigner was not found

Any ideas here?


The problem is I really need to pass an object during construction.

You see I have a designer which loads all the types that inherit from the CompositeBase. These are then added to a list from which the users can drag them to a designer. Upon doing so an instance of the dragged is added to the designer. Each of these classes have custom properties defined on them:

[CompositeMetaData('Delay','Sets the delay between commands',1)] [CompositeDesigner(typeof(DelayCompositeDesigner))] public class DelayComposite : CompositeBase { } 

When the user selects an item in the designer, it looks at these attributes in order to load up a designer for that type. For example, in the case of the DelayComposite it would load up a user control which has a label and a slider which allow the user to set the ‘Delay’ property of the DelayComposite instance.

So far this works fine if I don’t pass any parameters to the constructor. The designer creates an instance of the DelayCompositeDesigner and assigns it to the content property of a WPF ContentPresenter.

But since that designer needs to modify the properties of the selected DelayComposite in the designer, I have to pass this instance to it. That is why the constructor looks lie this:

public DelayCompositeDesigner(DelayComposite CompositeObject) {     InitializeComponent();      compositeObject = CompositeObject; } 

Suggestions are welcome


@VolkerK

The result of your code is this:

<—- foo Vialis.LightLink.Controller.Scenarios.Composites.DelayCompositeDesignerVoid .ctor() Vialis.LightLink.Controller.Scenarios.Composites.DelayCompositeDesignerVoid .ctor(Vialis.LightLink.Controller.Scenarios.Composites.DelayComposite) param:Vialis.LightLink.Controller.Scenarios.Composites.DelayComposite foo —->


Leppie, you were correct, I had for some reason referenced the Composites assembly in my UI application… which is not something I should have done as I was loading it at runtime. The following code works:

object composite = Activator.CreateInstance(item.CompositType,(byte)205);                     var designer = Activator.CreateInstance(designerAttribute.Designer, composite); 

As you can see the code does not have knowledge of the DelayComposite type.

This solves the current problem, but introduces many new ones for what I want to achieve, either way thank you and thank you to everyone who has replied here.


As for the following code, suggested by multiple people:

var designer = Activator.CreateInstance(     designerAttribute.Designer,      new object[] { new DelayComposite(4) }  ); 

The Activator.CreateInstance has a signature that looks like this:

Activator.CreateInstance(Type type, params object[] obj) 

So it should accept my code, but I will try the suggested code

UPDATE:

I’ve tried this as suggested:

var designer = Activator.CreateInstance(designerAttribute.Designer, new object[] { new DelayComposite(4)}); 

The result is the same.

  • 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. 2026-05-10T20:35:18+00:00Added an answer on May 10, 2026 at 8:35 pm

    I think you are dealing with a Type mismatch.

    Likely the assembly is referenced in different places, or they are compiled against different versions.

    I suggest you iterate through the ConstructorInfo’s and do a paramtype == typeof(DelayComposite) on the appropriate parameter.

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

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You will need to retrieve the 'memberOf' attribute from your… May 11, 2026 at 1:05 pm
  • added an answer If you declare the variable outside of any function as… May 11, 2026 at 1:05 pm
  • added an answer I agree that would be a nice feature. A better… May 11, 2026 at 1:05 pm

Related Questions

I have a class ReportingComponent<T> , which has the constructor: public ReportingComponent(IQueryable<T> query) {}
I have a class which represents a shape. The Shape class has a property
I have a component which has a List<T> property. The class in the list
I have a class which has many small functions. By small functions, I mean
In C++, I have a class which contains an anonymous bitfield struct. I want
In a constructor in Java, if you want to call another constructor (or a
I have a windows form application that uses a Shared class to house all
The Unity documentation states: if a class that developers instantiate using the Resolve method

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.