SQLCLR/ObjectBuilder error: "operation that was forbidden by the CLR host"

Feb 7, 2007 at 1:43 AM

Using the Microsoft Patterns and Practices "Object Builder" (Dependency Injection/Builder library), I wrote an SQL CLR Stored Procedure (using VS 2005 Professional).

All compiles and deploys ok (to SQL Server 2005 Express).

However, at run-time, I get the following error upon a "BuilderContext" object's instantiation: Attempted to perform an operation that was forbidden by the CLR host.

Thoughts on how to get ObjectBuilder working in the SQLCLR?



(posted below is the sample code...with the run-time exception occuring on the ...BuilderContext cxt = new ... call)

Microsoft.Practices.ObjectBuilder.BuilderStrategyChain chain =
new Microsoft.Practices.ObjectBuilder.BuilderStrategyChain();

chain.Add(new Microsoft.Practices.ObjectBuilder.CreationStrategy());

Microsoft.Practices.ObjectBuilder.Locator locator1 =
new Microsoft.Practices.ObjectBuilder.Locator(null);

// Get error when new'ing BuilderContext: "Attempted to perform an operation that was forbidden by the CLR host."
Microsoft.Practices.ObjectBuilder.BuilderContext cxt =
new Microsoft.Practices.ObjectBuilder.BuilderContext(chain, locator1, null);

Feb 10, 2007 at 1:40 AM
This discussion forum is meant for threads related to the CodePlex site itself. Please post your question over on the ObjectBuilder specific forum: http://www.codeplex.com/ObjectBuilder/Thread/List.aspx.