Possible Bug? External C# Functions not showing up?

Topics: General, Troubleshooting
May 5, 2011 at 5:48 AM
Edited May 5, 2011 at 7:02 AM

I have created External C# Functions that return Strings and others that return XHtmlDocument, but they aren't showing up in the Add Function Dialog. I believe this is since the upgrade to 2.1.1 but I'm not sure. The Starter site (also 2.1.1) seems to work fine. I have made the class public, the method is public statuc and I have add it to the UI, but when I try to add it using the Function Editor, neither the Function Name "GetFullName" or even the namespace "MyExtensions" shows up!!!

Steps I have taken:

  1. Created public class Extensions in VS2010
  2. Created public static method GetFullName in Extensions Class
  3. Added External C# Function named Extensions.GetFullName
  4. Opened XsltFunction "RenderAuthor"
  5. Add New Function Call... Function does NOT exist
  6. Try to add Function into Template... DOES NOT EXIST

I have deleted and re-added these functions but nothing works!!

There is nothing in the server log and I am perplexed as to what I can try.

Any ideas where I can start?

May 5, 2011 at 11:40 AM
Edited May 5, 2011 at 11:41 AM

I tried to repro your issue (see my steps below) and did not have any issues. If there is no info in the server log and the repro info below does not show a difference in methods I think the core group should take a look at your site. Would you be able to zip the site and send a url to me?

Here is my repro:

  1. Installed a new 2.1.1 site
  2. Using VS2010 to run the site (F5 thing)
  3. Create a file ~/App_COde/Extensions.cs with the following code:
    public class Extensions
        public static string GetFullName()
            return "full name dummy return value";
  4. In the C1 Console browse to the Functions perspective and click "Add External  C# function" on the "C# Functions" folder
  5. The add wizard started, for type I specified "Extensions" (clicked Next), for method name i selected "GetFullName" (clicked Next) - I then removed "." in Namespace name and clicked Finish
    (getting a C1 Function named "Extensions.GetFullName")
  6. I could call the function just fine and got the expected string from it.

One thing I noticed is that when adding the C# Function I was suggested ".Extensions" as namespace name and I had to remove the dot to be able to press Finish (or I would get a validation warning).

May 5, 2011 at 1:03 PM

No problem. I'll zip it and send you a link to the file.

That's pretty much exactly what I did to test. I'll PM you with further details.

May 6, 2011 at 1:54 AM

I sent you the link to the zipped site. Let me know if it's something that I can fix.

May 8, 2011 at 3:26 AM

I have some more information on this... I just realized that it affects all installed modules as well. I installed the Blog and C1 can't see the C# Blog functions, either on the site or in the Console.

May 10, 2011 at 8:57 AM
Edited May 10, 2011 at 11:45 AM

Remove FactorsGroup/Data/ArticleList function (Functions => C# functions). It's C# code is missing. This should fix. I've tested on your site.