Re: Potential Bug in 6.0 C# Scripting inside SDK
| Date : Wed, 27 Dec 2006 20:12:18 -0600 |
| To : XSI(at)Softimage.COM |
| From : "Kent Bowling" <kentamanos(at)gmail.com> |
| Subject : Re: Potential Bug in 6.0 C# Scripting inside SDK |
Thanks Ahmidou. I'll check on the website interface to the mailing list next time to make sure it went out (still not sure why I didn't receive it until about 30 minutes ago, but oh well).
I'm submitting that bug to the URL you provided in the meantime, but they should obviously add 6.0 to the list (as others have mentioned). Thanks for the link.
-Kent Bowling
On 12/27/06, Ahmidou Lyazidi <ahmidou.xsi(at)gmail.com> wrote:
actually i saw it on the list 15 hours ago, it arrived well. About the the bug, it is better to report via the request form, this way it will be logged :
http://www.softimage.com/support/support_services/request_form/default.aspx
2006/12/27, Kent Bowling <kentamanos(at)gmail.com>:Hmm, I sent this out 12 hours ago, but it still hasn't showed up on the list. You have to love the reliability of email (of course, the plausible deniability it creates is sometimes nice too :)). It's just a "bug report" on the C# scripting example (although the "bug" could be considered a .NET "feature").-Kent Bowling
On 12/27/06, Kent Bowling <kentamanos(at)gmail.com > wrote:I'm really stoked about the C# support (in reality, I would guess any .NET language could actually be used) in 6.0. I ran into a small problem playing around and just wanted to give a heads up for anyone playing around with C# scripting in XSI 6.0 (and trying to use any classes not in System.dll or System.Windows.Forms.dll).One of the SDK examples is a C# scripting plugin. The plugin allows you to write scripting in C# inside XSI and run them from inside XSI. The SDK Documentation on this example notes the following:"Note: The assemblies required by your C# code are not referenced automatically by the C# scripting plug-in. The C# compiler will issue an error if you are using an unknown assembly. The workaround is to add the reference manually to the C# scripting plug-in project. For instance, if you need to use System.Web in your code, you must add a reference to the References folder of CSharpScripting.csproj and recompile the project."While adding the reference to the project usually allows "using" directives to succeed (never could get that to work for System.Xml, the first assembly I was trying to tinker with), using actual code from those assemblies doesn't work. For instance, if I add System.Web to the project (like mentioned above) and attempt to run this script:using System;
using Softimage.XSIOM;
using System.Web;
class Script
{
public static void Main()
{
CXSIApplicationClass xsi = new CXSIApplicationClass();xsi.LogMessage(System.Web.HttpUtility.UrlEncode("a b c"), siSeverity.siInfo) ;
}
}The plugin fails to compile the dynamic assembly properly, and outputs the following to XSI's logging window:// ERROR : C# compilation failed:
// c:\Documents and Settings\Kent Bowling\Local Settings\Temp\XSI_Temp_2956\4fwzcolp.0.cs(11,29) : error CS0234: The type or namespace name 'HttpUtility' does not exist in the namespace ' System.Web' (are you missing an assembly reference?)
//
If I had not added the reference to the project by the way, it would have failed at the "using System.Web;" line, but still would fail when actually trying to use classes from System.Web. As I mentioned above, System.Xml never even worked on the "using" line by itself when adding the reference to the project.Instead of adding the reference to the project, one workaround is to add it to the list of assemblies referenced by hand in the code. The code has the following section in it (around line 341):public static string[] m_refAssemblies = new string[2]
{
"System.dll",
"System.Windows.Forms.dll"
};
If I change this to:public static string[] m_refAssemblies = new string[3]
{
"System.dll",
"System.Windows.Forms.dll",
"System.Web.dll"
};
Suddenly, the above script works, outputting:// INFO : a+b+c
(which is just a URL encoding for "a SPACE b SPACE c")A somewhat easy fix for this would obviously be changing the script a little so that the referenced assemblies are passed in and some configuration is added to specify them. Obviously that makes an SDK "example" a bit more complex (possibly too complex to be used as an example any more :)). I'll try to play around with this later and see what happens. This list could also be stored in a "standard" .NET config file for the assembly (foregoing the potentially confusing configuration UI).Another solution (although not as flexible) would be to somehow determine which assemblies the CSharpScripting.dll assembly references and automatically adding those to the above array. This would cause the example to work as the documentation indicates.Hope this helps, and let me know if anyone needs more information (and if there's a better place to report these types of things).-Kent Bowling
- Follow-Ups:
- Re: Potential Bug in 6.0 C# Scripting inside SDK
- From: "Kent Bowling" <kentamanos(at)gmail.com>
- Re: Potential Bug in 6.0 C# Scripting inside SDK
- References:
- Potential Bug in 6.0 C# Scripting inside SDK
- From: "Kent Bowling" <kentamanos(at)gmail.com>
- Re: Potential Bug in 6.0 C# Scripting inside SDK
- From: "Kent Bowling" <kentamanos(at)gmail.com>
- Re: Potential Bug in 6.0 C# Scripting inside SDK
- From: "Ahmidou Lyazidi" <ahmidou.xsi(at)gmail.com>
- Potential Bug in 6.0 C# Scripting inside SDK
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: Re: symmetry in XSI 6.0
- Next by Date: Re: symmetry in XSI 6.0
- Previous by Thread: Re: symmetry in XSI 6.0
- Next by Thread: Re: symmetry in XSI 6.0
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |