Boo
  1. Boo
  2. BOO-286

SVN 1486 (GAC-Friendly way of loading assembly) breaks BooBinding.

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.7
    • Component/s: #develop addin
    • Labels:
      None
    • Environment:
      SVN 1486.
    • Number of attachments :
      0

      Description

      SVN 1486's GAC-friendly way of loading assemblies seems to have broken BooBinding.

      ---------------------------
      Stack trace:
      ---------------------------
      Loading error, please reinstall :

      System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.

      at Boo.Lang.Compiler.Pipelines.Parse.NewParserStep()

      at Boo.Lang.Compiler.Pipelines.Parse..ctor()

      at Boo.Lang.Compiler.Pipelines.ResolveExpressions..ctor()

      at Boo.Lang.Compiler.Pipelines.Compile..ctor()

      at Boo.Lang.Compiler.Pipelines.CompileToMemory..ctor()

      at Boo.Lang.Interpreter.AbstractInterpreter..ctor()

      at Boo.Lang.Interpreter.InteractiveInterpreter..ctor()

      at booish.gui.InteractiveInterpreterControl..ctor()

      at BooBinding.BooishView..ctor() in C:\boo\extras\SharpDevelop\BooBinding\src\BooishView.boo:line 81

      — End of inner exception stack trace —

      at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)

      at System.Activator.CreateInstance(Type type, Boolean nonPublic)

      at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

      at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

      at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

      at ICSharpCode.Core.AddIns.AddIn.CreateObject(String className)

      at ICSharpCode.Core.AddIns.Codons.ClassCodon.BuildItem(Object owner, ArrayList subItems, ConditionCollection conditions)

      at ICSharpCode.Core.AddIns.DefaultAddInTreeNode.BuildChildItems(Object caller)

      at ICSharpCode.SharpDevelop.Gui.DefaultWorkbench.UpdatePadContents(Object sender, EventArgs e)

      at ICSharpCode.SharpDevelop.Commands.InitializeWorkbenchCommand.Run()

      at ICSharpCode.SharpDevelop.SharpDevelopMain.Main(String[] args)
      ---------------------------
      Done.
      ---------------------------

        Activity

        Hide
        Doug H added a comment -

        A workaround that worked for me is to change the code in the Parse pipeline such that, if the new way of loading the assembly fails, fall back to the old way. Here is the code I used below, but it doesn't handle the potential exception properly.

        If that is an unfeasible option, then we can work around it from within the #Develop addin by replacing the parser step with our own.

        namespace Boo.Lang.Compiler.Pipelines
        {
        using System;
        using System.Reflection;
        using Boo.Lang.Compiler.Steps;

        public class Parse : CompilerPipeline
        {
        static Type _defaultParserStepType;

        public static ICompilerStep NewParserStep()
        {
        if (null == _defaultParserStepType)
        {
        Assembly assembly = Assembly.LoadWithPartialName("Boo.Lang.Parser");
        if (assembly != null)

        { _defaultParserStepType = assembly.GetType("Boo.Lang.Parser.BooParsingStep", true); }

        else
        {
        try

        { _defaultParserStepType = Type.GetType("Boo.Lang.Parser.BooParsingStep, Boo.Lang.Parser", true); }

        catch

        {;}

        }
        }
        return (ICompilerStep)Activator.CreateInstance(_defaultParserStepType);
        }

        public Parse()

        { Add(NewParserStep()); }

        }
        }

        Show
        Doug H added a comment - A workaround that worked for me is to change the code in the Parse pipeline such that, if the new way of loading the assembly fails, fall back to the old way. Here is the code I used below, but it doesn't handle the potential exception properly. If that is an unfeasible option, then we can work around it from within the #Develop addin by replacing the parser step with our own. namespace Boo.Lang.Compiler.Pipelines { using System; using System.Reflection; using Boo.Lang.Compiler.Steps; public class Parse : CompilerPipeline { static Type _defaultParserStepType; public static ICompilerStep NewParserStep() { if (null == _defaultParserStepType) { Assembly assembly = Assembly.LoadWithPartialName("Boo.Lang.Parser"); if (assembly != null) { _defaultParserStepType = assembly.GetType("Boo.Lang.Parser.BooParsingStep", true); } else { try { _defaultParserStepType = Type.GetType("Boo.Lang.Parser.BooParsingStep, Boo.Lang.Parser", true); } catch {;} } } return (ICompilerStep)Activator.CreateInstance(_defaultParserStepType); } public Parse() { Add(NewParserStep()); } } }
        Hide
        Doug H added a comment -

        Actually the proper workaround may be to use Assembly.Load instead of Aseembly.loadwithpartialname.

        That workaround solves the problem for me too.

        Show
        Doug H added a comment - Actually the proper workaround may be to use Assembly.Load instead of Aseembly.loadwithpartialname. That workaround solves the problem for me too.
        Hide
        Rodrigo B. de Oliveira added a comment -

        fixed in the repository

        Show
        Rodrigo B. de Oliveira added a comment - fixed in the repository

          People

          • Assignee:
            Unassigned
            Reporter:
            Arron Washington
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: