Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
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 :
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.
---------------------------
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()
{ _defaultParserStepType = assembly.GetType("Boo.Lang.Parser.BooParsingStep", true); }{
if (null == _defaultParserStepType)
{
Assembly assembly = Assembly.LoadWithPartialName("Boo.Lang.Parser");
if (assembly != null)
else
{ _defaultParserStepType = Type.GetType("Boo.Lang.Parser.BooParsingStep, Boo.Lang.Parser", true); }{
try
catch
{;}}
}
return (ICompilerStep)Activator.CreateInstance(_defaultParserStepType);
}
public Parse()
{ Add(NewParserStep()); }}
}