Receiving "xxxx is not a valid GraphQL type name. (Parameter 'value')" when brackets are present in SetPath for ErrorBuilder in HotChocolate 12 - hotchocolate

This is necessary as I need to show which array element is causing the issue.
This was working fine before in HotChocolate 10, but after upgrading to 12 this is breaking. I am running the following line and it is breaking with the error below it:
IErrorBuilder errorBuilder = new ErrorBuilder()
.SetPath(new List<string>() { "Users[0]"})
"extensions": {
"message": "`Users[0]` is not a valid GraphQL type name. (Parameter 'value')",
"stackTrace": " at HotChocolate.NameString..ctor(String value)
at HotChocolate.NameString.ConvertFromString(String s)
at HotChocolate.Path.FromList(IReadOnlyList`1 path)
at HotChocolate.ErrorBuilder.SetPath(IReadOnlyList`1 path)
at AppAPI.Common.AppServicesExceptionHandler.ConstructQueryError(String type, String path, String idCode, String description, Dictionary`2 parameters) in \\Project.AppAPI HOT CHOCOLATE 12\\AppAPI WebAPI\\Common\\Exceptions\\AppServicesExceptionHandler.cs:line 268
at AppAPI.Common.AppServicesExceptionHandler.ProcessException(Exception e, IConfiguration configuration) in \\Project.AppAPI HOT CHOCOLATE 12\\AppAPI WebAPI\\Common\\Exceptions\\AppServicesExceptionHandler.cs:line 97
at AppAPI.Queries.TestByPeriodQuery.GetTestByPeriod(Int32 accountId, DateTime startUtcDate, DateTime endUtcDate, String aggregatePeriodIdCode, Int32[] Users, Int32[] monitorGroupIds, String[] groupByIdCodes, IMediator mediator, IMapper mapper, IHttpContextAccessor httpContextAccessor, IConfiguration configuration) in \\Project.AppAPI HOT CHOCOLATE 12\\AppAPI WebAPI\\Queries\\TestByPeriodQuery.cs:line 43
at HotChocolate.Resolvers.Expressions.ExpressionHelper.AwaitTaskHelper[T](Task`1 task)
at HotChocolate.Types.Helpers.FieldMiddlewareCompiler.<>c__DisplayClass9_0.<<CreateResolverMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at HotChocolate.AspNetCore.Authorization.AuthorizeMiddleware.InvokeAsync(IDirectiveContext context)
at HotChocolate.Utilities.MiddlewareCompiler`1.ExpressionHelper.AwaitTaskHelper(Task task)
at HotChocolate.Execution.Processing.Tasks.ResolverTask.ExecuteResolverPipelineAsync(CancellationToken cancellationToken)
at HotChocolate.Execution.Processing.Tasks.ResolverTask.TryExecuteAsync(CancellationToken cancellationToken)"
}

The error is exactly correct. The ErrorBuilder wants either a Path object or a List<object> which consists of the elements of the path.
ErrorBuilder.New()
.SetMessage("foo")
.SetPath(new List<object> { "Users", 0 })
.Build()
OR
You can use the path object:
ErrorBuilder.New()
.SetMessage("foo")
.SetPath(Path.New("Users").Append(0))
.Build()

Related

Retrieving XML from database with Dapper

I am using Dapper to query a table that includes an XML field:
CREATE TABLE Workflow
(
Guid uniqueidentifier not null,
State xml not null
)
which is then mapped to a property of type XDocument:
public class Workflow
{
public Guid InstanceId { get;set; }
public XDocument State { get;set; }
}
but when I try to query the table, I get the following error:
Error parsing column 1 (State= - String)
at Dapper.SqlMapper.ThrowDataException(Exception ex, Int32 index, IDataReader reader, Object value) in d:\\Dev\\dapper-dot-net\\Dapper NET40\\SqlMapper.cs:line 4045
at Deserialize038b29f4-d97d-4b62-b45b-786bd7d50e7a(IDataReader )
at Dapper.SqlMapper.<QueryImpl>d__11`1.MoveNext() in d:\\Dev\\dapper-dot-net\\Dapper NET40\\SqlMapper.cs:line 1572
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in d:\\Dev\\dapper-dot-net\\Dapper NET40\\SqlMapper.cs:line 1443
at MyProject.DapperBase.Query[TResult](String command, DynamicParameters parameters, IDbTransaction transaction, Boolean buffered, Int32 commandTimeout) in d:\\MyProject\\DapperBase.cs:line 122
at MyProject.WorkflowData.Get(Guid identifier) in d:\\MyProject\\WorkflowData.cs:line 41
at MyProject.WorkflowLogic.Save(Workflow workflow) in d:\\MyProject\\WorkflowLogic.cs:line 34
at MyProject.WorkflowsController.Save(Guid id, WorkflowRequest request) in d:\\MyProject\\WorkflowsController.cs:line 97
InnerException: Invalid cast from 'System.String' to 'System.Xml.Linq.XDocument'.
at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)at System.String.System.IConvertible.ToType(Type type, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType)
at Deserialize038b29f4-d97d-4b62-b45b-786bd7d50e7a(IDataReader )
Other than modifying my POCO to use a string datatype and then convert the string into an XDocument elsewhere, is there a way of getting Dapper to correctly deserialise the XML from the database?
In the end, I just brute-forced it:
public class Workflow
{
public Guid InstanceId { get;set; }
public XDocument StateIn { set { State = value.ToString(); } }
public string State { get;set; }
public XDocument StateOut { get { return XDocument.Parse(State); } }
}
Dapper plays with the State value, and I just set the value on StateIn and read it off StateOut. I feel a little bit dirty coming up with a solution like this, but hey, it works.
Perhaps creating a custom type handler can help? Something like:
public class XDocumentTypeHandler : SqlMapper.TypeHandler<XDocument>
{
public override void SetValue(IDbDataParameter parameter, XDocument value)
{
// set value in db parameter.
}
public XDocument Parse(object value)
{
// parse value from db to an XDocument.
}
}
You have to add the type handler with SqlMapper.AddTypeHandler().
See a sample implementation.

Specified Cast is not Invalid (Enum with int value, Dapper)

I have a class with a (simple, first cut) implementation of user roles:
class User {
public Role Role { get; set; }
// ...
public User() { this.Role = Role.Normal; }
public void Save() { Membership.CreateUser(...) } // System.Web.Security.Membership
}
enum Role : int {
Invalid = 0,
Normal = 1,
SuperUser = 4096
}
Before adding the role, everything worked fine (if that matters).
Now, when I try to fetch users, this line fails:
toReturn = conn.Query<User>("SELECT TOP 1 * FROM dbo.UserProfile WHERE 1=1");
The stack trace (from ELMAH):
System.Data.DataException: Error parsing column 2 (Role=1 - Int16) ---> System.InvalidCastException: Specified cast is not valid.
at Deserialize06df745b-4fad-4d55-aada-632ce72e3607(IDataReader )
--- End of inner exception stack trace ---
at Dapper.SqlMapper.ThrowDataException(Exception ex, Int32 index, IDataReader reader) in c:\Dev\Dapper\Dapper\SqlMapper.cs:line 2126
at Deserialize06df745b-4fad-4d55-aada-632ce72e3607(IDataReader )
at Dapper.SqlMapper.<QueryInternal>d__d`1.MoveNext() in c:\Dev\Dapper\Dapper\SqlMapper.cs:line 827
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in c:\Dev\Dapper\Dapper\SqlMapper.cs:line 770
In the database, the column type for Role is smallint.
I'm using Dapper 1.12.1 from NuGet.
Gah. The answer was to make the database and class definitions match.
For smallint (which is what MigratorDotNet generated for me), I needed the enum to derive from short, not int. Everything works now.
Possibly useful Google Code issue: https://code.google.com/p/dapper-dot-net/issues/detail?id=32

Does flyway migrations support PostgreSQL's COPY?

Having performed a pg_dump of an existing posgresql schema, I have an sql file containing a number of table population statements using the copy.
COPY test_table (id, itm, factor, created_timestamp, updated_timestamp, updated_by_user, version) FROM stdin;
1 600 0.000 2012-07-17 18:12:42.360828 2012-07-17 18:12:42.360828 system 0
2 700 0.000 2012-07-17 18:12:42.360828 2012-07-17 18:12:42.360828 system 0
\.
Though not standard this is part of PostgreSQL's PLSQL implementation.
Performing a flyway migration (via the maven plugin) I get:
[ERROR] Caused by org.postgresql.util.PSQLException: ERROR: unexpected message type 0x50 during COPY from stein
Am I doing something wrong, or is this just not supported?
Thanks.
The short answer is no.
The one definite problem is that the parser is currently not able to deal with this special construct.
The other question is jdbc driver support. Could you try and see if this syntax generally supported by the jdbc driver with a single createStatement call?
If it is, please file an issue in the issue tracker and I'll extend the parser.
Update: This is now supported
I have accomplished this for Postgres using
public abstract class SeedData implements JdbcMigration {
protected static final String CSV_COPY_STRING = "COPY %s(%s) FROM STDIN HEADER DELIMITER ',' CSV ENCODING 'UTF-8'";
protected CopyManager copyManager;
#Override
public void migrate(Connection connection) throws Exception {
log.info(String.format("[%s] Populating database with seed data", getClass().getName()));
copyManager = new CopyManager((BaseConnection) connection);
Resource[] resources = scanForResources();
List<Resource> res = Arrays.asList(resources);
for (Resource resource : res) {
load(resource);
}
}
private void load(Resource resource) throws SQLException, IOException {
String location = resource.getLocation();
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(location);
if (inputStream == null) {
throw new FlywayException("Failure to load seed data. Unable to load from location: " + location);
}
if (!inputStream.markSupported()) {
// Sanity check. We have to be able to mark the stream.
throw new FlywayException(
"Failure to load seed data as mark is not supported. Unable to load from location: " + location);
}
// set our mark to something big
inputStream.mark(1 << 32);
String filename = resource.getFilename();
// Strip the prefix (e.g. 01_) and the file extension (e.g. .csv)
String table = filename.substring(3, filename.length() - 4);
String columns = loadCsvHeader(location, inputStream);
// reset to the mark
inputStream.reset();
// Use Postgres COPY command to bring it in
long result = copyManager.copyIn(String.format(CSV_COPY_STRING, table, columns), inputStream);
log.info(format(" %s - Inserted %d rows", location, result));
}
private String loadCsvHeader(String location, InputStream inputStream) {
try {
return new BufferedReader(new InputStreamReader(inputStream)).readLine();
} catch (IOException e) {
throw new FlywayException("Failure to load seed data. Unable to load from location: " + location, e);
}
}
private Resource[] scanForResources() throws IOException {
return new ClassPathScanner(getClass().getClassLoader()).scanForResources(getSeedDataLocation(), "", ".csv");
}
protected String getSeedDataLocation() {
return getClass().getPackage().getName().replace('.', '/');
}
}
To use implement the class with the appropriate classpath
package db.devSeedData.dev;
public class v0_90__seed extends db.devSeedData.v0_90__seed {
}
All that is needed then is to have CSV files in your classpath under db/devSeedData that follow the format 01_tablename.csv. Columns are extracted from the header line of the CSV.

GWT RequestFactory with Objectify: ServerFailure error returns when firing request

I'm trying to customize the App Engine Connected Android project on Eclipse. I'm using Objectify in place of JPA and have been following the Turbocharge example to setup my basic framework (using a DAO layer).
I'm currently working on the web side of things, but I'm having trouble getting my entities to persist on the development server: my requests return a ServerFailure error on Receivers' onFailure() method. But doesn't really provide any clues as to why that is (all variables are null).
Any help would be greatly appreciated!
Here's my EntryPoint class:
public class Manager implements EntryPoint {
private static final Logger log = Logger.getLogger(Manager.class.getName());
private final EventBus eventBus = new SimpleEventBus();
private ManagerRequestFactory rf = GWT.create(ManagerRequestFactory.class);
#Override
public void onModuleLoad() {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
#Override
public void onUncaughtException(Throwable e) {
log.finest("uncaught exception: ");
e.printStackTrace();
}
});
rf.initialize(eventBus);
log.setLevel(Level.FINE);
PersonRequest personRequest = rf.personRequest();
// Populate the database with sample data
PersonProxy person = personRequest.create(PersonProxy.class);
person.setFirstName("John1");
person.setLastName("Doe");
person.setEmail("jd#gmail.com");
person.setMainPhone("215-555-1212");
personRequest.saveAndReturn(person).fire(new Receiver<PersonProxy>(){
#Override
public void onSuccess(PersonProxy response) {
log.info("got response: " + response.getFirstName());
}
#Override
public void onFailure(ServerFailure error) {
log.info("Server Failure type: " + error.getExceptionType());
log.info("Failure message: " + error.getMessage());
log.info("Stack Trace: " + error.getStackTraceString());
log.info(error.isFatal() ? "error is fatal" : "error is not fatal");
super.onFailure(error);
}
});
I followed the code in debug mode through the stacks to the point where it returns the error. Here's the Stack
Daemon Thread [Code server for manager from Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7 on http://127.0.0.1:8888/manager/hosted.html?manager # d6:JVCMo.q:W,$wW] (Suspended (exception UmbrellaException))
AbstractRequestContext$StandardPayloadDialect.processPayload(Receiver<Void>, String) line: 387
AbstractRequestContext$5.onTransportSuccess(String) line: 1108
DefaultRequestTransport$1.onResponseReceived(Request, Response) line: 136
Request.fireOnResponseReceived(RequestCallback) line: 287
RequestBuilder$1.onReadyStateChange(XMLHttpRequest) line: 395
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
Method.invoke(Object, Object...) line: not available
MethodAdaptor.invoke(Object, Object...) line: 103
MethodDispatch.invoke(JsValue, JsValue[], JsValue) line: 71
OophmSessionHandler.invoke(BrowserChannelServer, BrowserChannel$Value, int, BrowserChannel$Value[]) line: 172
BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer$SessionHandlerServer) line: 337
BrowserChannelServer.invokeJavascript(CompilingClassLoader, JsValueOOPHM, String, JsValueOOPHM[], JsValueOOPHM) line: 218
ModuleSpaceOOPHM.doInvoke(String, Object, Class<?>[], Object[]) line: 136
ModuleSpaceOOPHM(ModuleSpace).invokeNative(String, Object, Class<?>[], Object[]) line: 561
ModuleSpaceOOPHM(ModuleSpace).invokeNativeObject(String, Object, Class<?>[], Object[]) line: 269
JavaScriptHost.invokeNativeObject(String, Object, Class<?>[], Object[]) line: 91
Impl.apply(Object, Object, Object) line: not available
Impl.entry0(Object, Object, Object) line: 213
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
Method.invoke(Object, Object...) line: not available
MethodAdaptor.invoke(Object, Object...) line: 103
MethodDispatch.invoke(JsValue, JsValue[], JsValue) line: 71
OophmSessionHandler.invoke(BrowserChannelServer, BrowserChannel$Value, int, BrowserChannel$Value[]) line: 172
BrowserChannelServer.reactToMessages(BrowserChannelServer$SessionHandlerServer) line: 292
BrowserChannelServer.processConnection() line: 546
BrowserChannelServer.run() line: 363
Thread.run() line: not available
And here I have a snapshot of the Variables for response and error:
response ResponseMessageAutoBean$1 (id=566)
this$0 ResponseMessageAutoBean (id=581)
data JsonSplittable (id=583)
array null
bool null
isNull false
number null
obj JSONObject (id=597)
reified HashMap<K,V> (id=598)
string null
factory MessageFactoryImpl (id=584)
creatorMap JavaScriptObject$ (id=608)
enumToStringMap HashMap<K,V> (id=609)
stringsToEnumsMap HashMap<K,V> (id=610)
frozen false
shim ResponseMessageAutoBean$1 (id=566)
this$0 ResponseMessageAutoBean (id=581)
data JsonSplittable (id=583)
factory MessageFactoryImpl (id=584)
frozen false
shim ResponseMessageAutoBean$1 (id=566)
tags null
usingSimplePeer true
wrapped ResponseMessageAutoBean$2 (id=587)
tags null
usingSimplePeer true
wrapped ResponseMessageAutoBean$2 (id=587)
causes HashSet<E> (id=570)
[0] RuntimeException (id=576)
cause RuntimeException (id=576)
detailMessage "Server Error: null" (id=579)
stackTrace null
This error indicates that the server had an error, hence "Server Error: null" - an exception was thrown, but no message was associated with it to send to the client. Based on your code, it is probably in the saveAndReturn method on the server. Try stepping through there, or surrounding the body of the method with a try/catch to get the error. Your server log may shed more light on the issue, if enough logging is being used when errors occur.

WPF unity Activation error occured while trying to get instance of type

I am getting the following error when trying to Initialise the Module using Unity and Prism. The DLL is found by
return new DirectoryModuleCatalog() { ModulePath = #".\Modules" };
The dll is found and the Name is Found
#region Constructors
public AdminModule(
IUnityContainer container,
IScreenFactoryRegistry screenFactoryRegistry,
IEventAggregator eventAggregator,
IBusyService busyService
)
: base(container, screenFactoryRegistry)
{
this.EventAggregator = eventAggregator;
this.BusyService = busyService;
}
#endregion
#region Properties
protected IEventAggregator EventAggregator { get; set; }
protected IBusyService BusyService { get; set; }
#endregion
public override void Initialize()
{
base.Initialize();
}
#region Register Screen Factories
protected override void RegisterScreenFactories()
{
this.ScreenFactoryRegistry.Register(ScreenKeyType.ApplicationAdmin, typeof(AdminScreenFactory));
}
#endregion
#region Register Views and Various Services
protected override void RegisterViewsAndServices()
{
//View Models
this.Container.RegisterType<IAdminViewModel, AdminViewModel>();
}
#endregion
the code that produces the error is:
namespace Microsoft.Practices.Composite.Modularity
protected virtual IModule CreateModule(string typeName)
{
Type moduleType = Type.GetType(typeName);
if (moduleType == null)
{
throw new ModuleInitializeException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.FailedToGetType, typeName));
}
return (IModule)this.serviceLocator.GetInstance(moduleType); <-- Error Here
}
Can Anyone Help Me
Error Log Below:
General Information
Additional Info:
ExceptionManager.MachineName: xxxxx
ExceptionManager.TimeStamp: 22/02/2010 10:16:55 AM
ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.3591.32238, Culture=neutral, PublicKeyToken=null
ExceptionManager.AppDomainName: Infinity.vshost.exe
ExceptionManager.ThreadIdentity:
ExceptionManager.WindowsIdentity: xxxxx
1) Exception Information
Exception Type: Microsoft.Practices.Composite.Modularity.ModuleInitializeException
ModuleName: AdminModule
Message: An exception occurred while initializing module 'AdminModule'.
- The exception message was: Activation error occured while trying to get instance of type AdminModule, key ""
Check the InnerException property of the exception for more information. If the exception occurred
while creating an object in a DI container, you can exception.GetRootException() to help locate the
root cause of the problem.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void HandleModuleInitializationError(Microsoft.Practices.Composite.Modularity.ModuleInfo, System.String, System.Exception)
HelpLink: NULL
Source: Microsoft.Practices.Composite
StackTrace Information
at Microsoft.Practices.Composite.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)
at Microsoft.Practices.Composite.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
at Microsoft.Practices.Composite.Modularity.ModuleManager.InitializeModule(ModuleInfo moduleInfo)
at Microsoft.Practices.Composite.Modularity.ModuleManager.LoadModulesThatAreReadyForLoad()
at Microsoft.Practices.Composite.Modularity.ModuleManager.OnModuleTypeLoaded(ModuleInfo typeLoadedModuleInfo, Exception error)
at Microsoft.Practices.Composite.Modularity.FileModuleTypeLoader.BeginLoadModuleType(ModuleInfo moduleInfo, ModuleTypeLoadedCallback callback)
at Microsoft.Practices.Composite.Modularity.ModuleManager.BeginRetrievingModule(ModuleInfo moduleInfo)
at Microsoft.Practices.Composite.Modularity.ModuleManager.LoadModuleTypes(IEnumerable`1 moduleInfos)
at Microsoft.Practices.Composite.Modularity.ModuleManager.LoadModulesWhenAvailable()
at Microsoft.Practices.Composite.Modularity.ModuleManager.Run()
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.InitializeModules()
at Infinity.Bootstrapper.InitializeModules() in D:\Projects\dotNet\Infinity\source\Inifinty\Infinity\Application Modules\BootStrapper.cs:line 75
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
at Microsoft.Practices.Composite.UnityExtensions.UnityBootstrapper.Run()
at Infinity.App.Application_Startup(Object sender, StartupEventArgs e) in D:\Projects\dotNet\Infinity\source\Inifinty\Infinity\App.xaml.cs:line 37
at System.Windows.Application.OnStartup(StartupEventArgs e)
at System.Windows.Application.<.ctor>b__0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
2) Exception Information
Exception Type: Microsoft.Practices.ServiceLocation.ActivationException
Message: Activation error occured while trying to get instance of type AdminModule, key ""
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object GetInstance(System.Type, System.String)
HelpLink: NULL
Source: Microsoft.Practices.ServiceLocation
StackTrace Information
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType)
at Microsoft.Practices.Composite.Modularity.ModuleInitializer.CreateModule(String typeName)
at Microsoft.Practices.Composite.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
3) Exception Information
Exception Type: Microsoft.Practices.Unity.ResolutionFailedException
TypeRequested: AdminModule
NameRequested: NULL
Message: Resolution of the dependency failed, type = "Infinity.Modules.Admin.AdminModule", name = "". Exception message is: The current build operation (build key Build Key[Infinity.Modules.Admin.AdminModule, null]) failed: The parameter screenFactoryRegistry could not be resolved when attempting to call constructor Infinity.Modules.Admin.AdminModule(Microsoft.Practices.Unity.IUnityContainer container, PhoenixIT.IScreenFactoryRegistry screenFactoryRegistry, Microsoft.Practices.Composite.Events.IEventAggregator eventAggregator, PhoenixIT.IBusyService busyService). (Strategy type BuildPlanStrategy, index 3)
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object DoBuildUp(System.Type, System.Object, System.String)
HelpLink: NULL
Source: Microsoft.Practices.Unity
StackTrace Information
*********************************************
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name)
at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name)
at Microsoft.Practices.Composite.UnityExtensions.UnityServiceLocatorAdapter.DoGetInstance(Type serviceType, String key)
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
4) Exception Information
Exception Type: Microsoft.Practices.ObjectBuilder2.BuildFailedException
ExecutingStrategyTypeName: BuildPlanStrategy
ExecutingStrategyIndex: 3
BuildKey: Build Key[Infinity.Modules.Admin.AdminModule, null]
Message: The current build operation (build key Build Key[Infinity.Modules.Admin.AdminModule, null]) failed: The parameter screenFactoryRegistry could not be resolved when attempting to call constructor Infinity.Modules.Admin.AdminModule(Microsoft.Practices.Unity.IUnityContainer container, PhoenixIT.IScreenFactoryRegistry screenFactoryRegistry, Microsoft.Practices.Composite.Events.IEventAggregator eventAggregator, PhoenixIT.IBusyService busyService). (Strategy type BuildPlanStrategy, index 3)
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext)
HelpLink: NULL
Source: Microsoft.Practices.ObjectBuilder2
StackTrace Information
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp(IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name)
5) Exception Information
Exception Type: System.InvalidOperationException
Message: The parameter screenFactoryRegistry could not be resolved when attempting to call constructor Infinity.Modules.Admin.AdminModule(Microsoft.Practices.Unity.IUnityContainer container, PhoenixIT.IScreenFactoryRegistry screenFactoryRegistry, Microsoft.Practices.Composite.Events.IEventAggregator eventAggregator, PhoenixIT.IBusyService busyService).
Data: System.Collections.ListDictionaryInternal
TargetSite: Void ThrowForResolutionFailed(System.Exception, System.String, System.String, Microsoft.Practices.ObjectBuilder2.IBuilderContext)
HelpLink: NULL
Source: Microsoft.Practices.ObjectBuilder2
StackTrace Information
at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.ThrowForResolutionFailed(Exception inner, String parameterName, String constructorSignature, IBuilderContext context)
at BuildUp_Infinity.Modules.Admin.AdminModule(IBuilderContext )
at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
6) Exception Information
Exception Type: Microsoft.Practices.ObjectBuilder2.BuildFailedException
ExecutingStrategyTypeName: BuildPlanStrategy
ExecutingStrategyIndex: 3
BuildKey: Build Key[PhoenixIT.IScreenFactoryRegistry, null]
Message: The current build operation (build key Build Key[PhoenixIT.IScreenFactoryRegistry, null]) failed: The current type, PhoenixIT.IScreenFactoryRegistry, is an interface and cannot be constructed. Are you missing a type mapping? (Strategy type BuildPlanStrategy, index 3)
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Object ExecuteBuildUp(Microsoft.Practices.ObjectBuilder2.IBuilderContext)
HelpLink: NULL
Source: Microsoft.Practices.ObjectBuilder2
StackTrace Information
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
at Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context)
at BuildUp_Infinity.Modules.Admin.AdminModule(IBuilderContext )
7) Exception Information
Exception Type: System.InvalidOperationException
Message: The current type, PhoenixIT.IScreenFactoryRegistry, is an interface and cannot be constructed. Are you missing a type mapping?
Data: System.Collections.ListDictionaryInternal
TargetSite: Void ThrowForAttemptingToConstructInterface(Microsoft.Practices.ObjectBuilder2.IBuilderContext)
HelpLink: NULL
Source: Microsoft.Practices.ObjectBuilder2
StackTrace Information
at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.ThrowForAttemptingToConstructInterface(IBuilderContext context)
at BuildUp_PhoenixIT.IScreenFactoryRegistry(IBuilderContext )
at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
The innermost exception is the issue.
Your Module type needs a parameter called "screenFactoryRegistry" of type IScreenFactoryRegistry. Since IScreenFactoryRegistry is an interface and you apparently have not done a Register in the container to map that interface to a concrete type, the Unity container throws an exception.
To resolve this, you'd need to map that type in Unity, probably in the ConfigureContainer method of your bootstrapper:
Container.RegisterType<IScreenFactoryRegistry, MyScreenFactoryRegistryImplementation>();

Resources