Results 1 to 4 of 4

Thread: C#: loadPlugin() in PluginManagerI.cs

  1. #1
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159

    C#: loadPlugin() in PluginManagerI.cs

    I am trying to write an SSL plugin for IceCS under .NET 2.0.
    However, I cannot get it to load. As far as I understand
    assembly loading, the code in PluginManagerI.loadPlugin()
    will not work.

    This line:
    System.Type c = System.Type.GetType(className);
    works only if the plugin assembly is already loaded, which
    seems like a catch 22, since loading the assembly is
    the purpose of loadPlugin().

    This line:
    System.Type c = IceInternal.AssemblyUtil.findType(className);
    won't work either, as the new plugin is not referenced by IceCS.dll.

    I suggest that for loading a plugin under .NET, one specifies
    two identifiers, an assembly name/path, and a class name
    (e.g. IceSsl.PluginFactory).

    The code belwo seems to work for me. It assumes that the
    value of the Ice.Plugin.IceSSL property is the class name,
    followed by @ and then the assembly file path. Here it is,

    private void loadPlugin(string name, string className, string[] args)
    {
    Debug.Assert(_communicator != null);

    // separate out assembly path
    int sepPos = className.IndexOf('@');
    if (sepPos == -1) {
    PluginInitializationException e = new PluginInitializationException();
    e.reason = "no assembly path provided: " + className;
    throw e;
    }

    Assembly pluginAssembly = null;
    string assemblyName = className.Substring(sepPos + 1);
    try {
    if (File.Exists(assemblyName))
    pluginAssembly = Assembly.LoadFrom(assemblyName);
    else
    pluginAssembly = Assembly.Load(assemblyName);
    }
    catch {
    PluginInitializationException e = new PluginInitializationException();
    e.reason = "cannot load assembly: " + assemblyName;
    throw e;
    }

    //
    // Instantiate the class.
    //
    PluginFactory factory = null;
    className = className.Substring(0, sepPos);
    System.Type c = pluginAssembly.GetType(className);

    .... and so forth, as in the original code.

  2. #2
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    Please see this post regarding our support policy:

    http://www.zeroc.com/vbulletin/showthread.php?t=1697

  3. #3
    kwaclaw is offline Registered User
    Name: Karl Waclawek
    Organization: Personal
    Project: Whiteboard application
    Join Date
    Sep 2004
    Location
    Oshawa, Canada
    Posts
    159
    Quote Originally Posted by marc
    Please see this post regarding our support policy:

    http://www.zeroc.com/vbulletin/showthread.php?t=1697
    I don't request support, I am just bringing this to your attention.

  4. #4
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Thanks for the bug report, I'll have a look at fixing this for the next release.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using clr:property with cs:attribute
    By JVerwey in forum Help Center
    Replies: 2
    Last Post: 01-23-2009, 02:42 PM
  2. IceSL 0.3.2: ArgumentException in IceConnection.cs
    By kwaclaw in forum Bug Reports
    Replies: 0
    Last Post: 10-20-2008, 05:41 PM
  3. perhaps a bug in pather.cs
    By OrNot in forum Bug Reports
    Replies: 7
    Last Post: 03-14-2006, 12:43 AM
  4. perhaps a mistake in IncomingAsync.cs
    By xiehua in forum Bug Reports
    Replies: 1
    Last Post: 02-04-2006, 10:32 AM
  5. CS: compiler warning
    By DeepDiver in forum Bug Reports
    Replies: 2
    Last Post: 01-10-2005, 07:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •