nikhilk/scriptsharp — Issue #113: Generate Global Method Error
Author: chenxustu1
Created: 2011-10-09 02:36:55+00:00
State: open

I have a ScriptSharp project:

# TestPage.cs
namespace TestIndex
{
[GlobalMethods]
internal static class TestPage
{
static TestPage()
{
ShowMessage();
}

private static void ShowMessage()
{
Script.Alert("HelloWorld");
}
}
}

# TestIndex.script

//! #= ScriptFile ##
//

(function($) {
#include[as-is] "%code%"
})(jQuery);

//! This script was generated using Script# v#= CompilerVersion ##

# Generated Js file TestIndex.debug.js
(function ($) {
Type.registerNamespace('TestIndex');
window._showMessage = function TestIndex__testPage$_showMessage() {
alert('HelloWorld');
}
(function () {
_showMessage();
})();
})(jQuery);

Firebug showed this error info:
function TestIndex__testPage$_showMessage() {alert("HelloWorld");}(function () {_showMessage();}) is not a function