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 8093653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:32:52+00:00 2026-06-05T20:32:52+00:00

Overview: I am writting an application to dynamically load .dlls and call their methods.

  • 0

Overview:

I am writting an application to dynamically load .dlls and call their methods.

Since the .dlls are doing heavy i/o in background, i’ve made callbacks to notify the UI about what’s happening “down there”

Pieces of Code:

            dllName = (string) e.Argument;

            // Assembling Complete path for the .dll file
            completePath       = Path.Combine(ConfigurationManager.AppSettings["DllsFolder"], dllName);
            Assembly assembler = Assembly.LoadFrom (completePath);

            // Creating Instance of Crawler Object (Dynamically)
            dllWithoutExtension = Path.GetFileNameWithoutExtension (dllName);
            Type crawlerType    = assembler.GetType (dllWithoutExtension + ".Crawler");
            object  crawlerObj  = assembler.CreateInstance (crawlerType.FullName);

            // Fetching reference to the methods that must be invoked
            MethodInfo crawlMethod       = crawlerType.GetMethod ("StartCrawling");
            MethodInfo setCallbackMethod = crawlerType.GetMethod ("SetCallback");

So far, so good.
The problem is that, even tho i have declared the “callback” method

public void Notify (string courseName, int subjects, int semesters)
    {
        string course = courseName;
        int a = subjects;
        int b = semesters;
    }

This code works (just to test if the callback declaration is working)

             Crawler crawler = new Crawler();
             crawler.SetCallback (Notify);
             crawler.StartCrawling();

While this, does not work (this is what i am trying to fix. Calling the .dll method dinamically, passing the callback as argument)

setCallbackMethod.Invoke(crawlerObj, new object[] { Notify }); // this method fails, bc its a callback parameter
crawlMethod.Invoke(crawlerObj, new object[] {true}    ); // This method works, bc its a bool parameter
  • 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-06-05T20:32:53+00:00Added an answer on June 5, 2026 at 8:32 pm

    I assume you have a delegate type like this for passing the method to SetCallback:

    public delegate void CrawlerCallback(string courseName, int subjects, int semesters);
    

    Then you may pass the Notify method if you cast it to this delegate type like this:

    setCallbackMethod.Invoke(crawlerObj, new object[] { (CrawlerCallback)Notify });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call a C library from a Python application. I don't want
Overview This is calculator Web application On IBM Website about JavaServer Faces Tutorial. I'm
Overview I’m building a simple web application consisting of a canvas and elements on
Overview: I have an application that sometimes must make something with celery- and if
Problem Overview I have a dynamically produced web page, X , which consists of
Overview I am generating a four page PDF document in an iPad application that
Overview I'm trying to build a graphic in my game by combining a few
Overview I have an iOS app which sends local notifications at specific dates. I
Overview: I have an advancedDataGrid that I am using a GroupingCollection on and I
Overview I am using CompositeWPF to create an app using C#. This really should

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.