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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:39:48+00:00 2026-05-30T02:39:48+00:00

I have been following the guidance given on this other post: Assigning an IronPython

  • 0

I have been following the guidance given on this other post:

Assigning an IronPython method to a C# delegate

This post also references another resource on the darker corners of IronPython that has some useful information:

http://www.voidspace.org.uk/ironpython/dark-corners.shtml

I am trying to invoke an IronPython method from C# as a delegate. My latest attempt looks as follows (using System.Action):

IronPython Code:

delegate = Action[String](self.testErrorDelegate);
#csharp library method call
csharp_library.InvokeAction(delegate);

…

@unittest.skip("dev skipping")
def testErrorDelegate(self,message):
    print "error delegate"
    print message;

csharp library code:

public void InvokeAction(Action<string> listener)
{
    Console.WriteLine("BEFORE INVOKE");
    listener("DO SOMETHING");
    Console.WriteLine("AFTER INVOKE");
}

My problem is I get no output from the python testErrorDelegate when running this. No runtime errors either. I see the C# Console.WriteLine statements but “DO SOMETHING” is never printed.

Any idea on what I could be doing wrong here?

I have also tried doing the same approach casting directly to a C# delegate from the python method. I saw the same behavior using that approach, i.e. verification of C# method call, but not return call to python code via delegate.

I am using IronPython 2.7.1 (ipy.exe).

  • 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-30T02:39:50+00:00Added an answer on May 30, 2026 at 2:39 am

    It looks like this was an issue with using a reference to a function that was a skipped “unittest”.

    I had:

    @unittest.skip("dev skipping")
    def testErrorDelegate(self,message):
        print "error delegate"
        print message;
    

    changed to:

    def errorDelegate(self,message):
        print "error delegate"
        print message;
    

    I also changed to using inheritance from a CLR class in the Python code to keep the function registration done entirely in the python code.

    I guess the @unittest.skip annotation does something strange with the visibility of the method?

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

Sidebar

Related Questions

I have been following the following post on using multiple ItemTemplates in a ListView
I'm new to NHibernate... I have been following this NHibernate Tutorial from Gabriel Schenker
I have been given the following request. Please give 7% of the current contacts
I have been straggling as to how to implement the following scenario. Any guidance
I have been following this URL to help me create template views using BrowserView.
I have been following this convention thus far: std::string line; while(std::getline(in,line)) { if(line.size() &&
I have been following the example on the bottom of this page: http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribbon.ribbonapplicationmenu.auxiliarypanecontent.aspx to
I have been following the Answers to this question Detach subdirectory into separate Git
I have been following the forgers win32 tutorial, specifically this section as of this
I have been following this tutorial . Basically I want to take an address

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.