Ayende,
A test is below. It is not the best of tests but should be good enough
to repro. Just run a couple of times. Also got this reply from the boo
group
http://groups.google.com/group/boolang/browse_thread/thread/323a67d7dd84330b
Hope this helps. Thanks again.
namespace TestProject1
{
public abstract class Test {
public int MyProperty { get; set; }
public abstract void Run();
}
public class TestDslEngine : DslEngine
{
protected override void
CustomizeCompiler(Boo.Lang.Compiler.BooCompiler compiler,
Boo.Lang.Compiler.CompilerPipeline pipeline, string[] urls)
{
compiler.Parameters.Ducky = true;
pipeline.Insert(1, new
ImplicitBaseClassCompilerStep(typeof(Test), "Run"));
pipeline.InsertBefore(typeof(ProcessMethodBodiesWithDuckTyping), new
UnderscoreNamingConventionsToPascalCaseCompilerStep());
}
}
[TestClass]
public class UnitTest1
{
DslFactory dslfactory = new DslFactory();
[TestMethod]
public void TestMethod1()
{
dslfactory.Register<Test>(new TestDslEngine());
var result = Parallel.For(1, 10, p => CreateAll());
}
private void CreateAll()
{
dslfactory.CreateAll<Test>(@"C:\Users\nabils\Documents
\visual studio 2010\Projects\TestProject1\TestProject1\scripts");
}
}
}
On Sep 10, 5:52 pm, Ayende Rahien <[email protected]> wrote:
> Can you create a test case for repro?
>
>
>
> On Fri, Sep 10, 2010 at 7:28 PM, nabils <[email protected]> wrote:
> > When running in a web application and only when multiple requests
> > (multiple threads) are being made I get the following error when
> > constructing the Boo compiler. My DslFactory is a singleton instance
> > that is created in global.asax. I also register the DslEngine in the
> > global.asax staright after creating the DslFactory.
> > This does not happen when one request is made. Does anyone have any
> > idea why this is happening?
>
> > Thanks
> > Regards,
> > Nabil
>
> > System.ArgumentException occurred
> > Message=An item with the same key has already been added.
> > Source=mscorlib
> > StackTrace:
> > at System.ThrowHelper.ThrowArgumentException(ExceptionResource
> > resource)
> > at System.Collections.Generic.Dictionary`2.Insert(TKey key,
> > TValue value, Boolean add)
> > at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue
> > value)
> > at Boo.Lang.Compiler.Util.Memo`2.Produce(TKey key, Func`2
> > producer)
> > at
>
> > Boo.Lang.Compiler.TypeSystem.Reflection.ReflectionTypeSystemProvider.ForAss
> > embly(Assembly
> > assembly)
> > at Boo.Lang.Compiler.CompilerParameters.LoadAssembly(String
> > assemblyName, Boolean throwOnError)
> > at Boo.Lang.Compiler.CompilerParameters.LoadDefaultReferences()
> > at
> > Boo.Lang.Compiler.CompilerParameters..ctor(IReflectionTypeSystemProvider
> > reflectionProvider, Boolean loadDefaultReferences)
> > at Boo.Lang.Compiler.CompilerParameters..ctor(Boolean
> > loadDefaultReferences)
> > at Boo.Lang.Compiler.CompilerParameters..ctor()
> > at Boo.Lang.Compiler.BooCompiler..ctor()
> > at Rhino.DSL.DslEngine.ForceCompile(String[] urls, String
> > cacheFileName) in c:\Dev\ayende-rhino-dsl-71f7768\Rhino.DSL
> > \DslEngine.cs:line 92
> > InnerException:
>
> > Stacktrace:
>
> > > Rhino.DSL.DLL!Rhino.DSL.DslEngine.ForceCompile(string[] urls,
> > string cacheFileName) Line 92 + 0x15 bytes C#
> > Rhino.DSL.DLL!
> > Rhino.DSL.DslCompilerContextCache.GetCached(Rhino.DSL.DslEngine
> > engine, string[] urls) Line 68 + 0x1a bytes C#
> > Rhino.DSL.DLL!Rhino.DSL.DslEngine.Compile(string[] urls) Line 72 +
> > 0x1b bytes C#
> > Rhino.DSL.DLL!
>
> > Rhino.DSL.DslFactory.CreateInternal<ServiceLayer.Dsl.AuthorisationRule>.Ano
> > nymousMethod__3()
> > Line 130 + 0x11 bytes C#
> > Rhino.DSL.DLL!
> > Rhino.DSL.AbstractLockable.ReadLock(Rhino.DSL.CacheAction cacheAction)
> > Line 52 + 0xb bytes C#
> > Rhino.DSL.DLL!
>
> > Rhino.DSL.DslFactory.CreateInternal<ServiceLayer.Dsl.AuthorisationRule>(Rhi
> > no.DSL.DslFactory.ScriptNotFoundBehavior
> > notFoundBehavior, string url, object[] parameters) Line 111 + 0x59
> > bytes C#
> > Rhino.DSL.DLL!
> > Rhino.DSL.DslFactory.Create<ServiceLayer.Dsl.AuthorisationRule>(string
> > url, object[] parameters) Line 49 + 0x35 bytes C#
> > Rhino.DSL.DLL!
>
> > Rhino.DSL.DslFactory.CreateAll<ServiceLayer.Dsl.AuthorisationRule>.Anonymou
> > sMethod__0()
> > Line 82 + 0x58 bytes C#
> > Rhino.DSL.DLL!
> > Rhino.DSL.AbstractLockable.ReadLock(Rhino.DSL.CacheAction cacheAction)
> > Line 58 + 0xb bytes C#
> > Rhino.DSL.DLL!
> > Rhino.DSL.DslFactory.CreateAll<ServiceLayer.Dsl.AuthorisationRule>(string
> > parentUrl, object[] parameters) Line 78 + 0x59 bytes C#
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Rhino Tools Dev" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<rhino-tools-dev%2Bunsubscribe@
> > googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rhino-tools-dev?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en.