WhatDoIHave says I have it. ObjectFactory says I don't

69 views
Skip to first unread message

Raif

unread,
Mar 7, 2013, 10:12:41 AM3/7/13
to structure...@googlegroups.com
Jeez louise,  I'm trying to retro fit a plague ridden legacy app with SM and running into all sorts of strangeness.  So I apologize for all the strange questions.
so I have this code 
 var whatDoIHave = ObjectFactory.Container.WhatDoIHave();
 var validator = ObjectFactory.GetInstance<IValidator<ProfileActivityElement>>();

the what do I have has this 
IValidator`1<ProfileActivityElement> (IValidator`1<ProfileActivityElement>)                                                                                                                                                                                                                                                                                                                                                                                                                                                          
Scoped as:  Transient

                                                                                                                                           4b774bc1-b46e-4fc1-95f4-348bb3786dc8                                                                                                                                                Configured Instance of HSTM.HLC.BusinessLogic.Validators.ProfileActivityElememntValidator, HSTM.HLC.BusinessLogic, Version=13.1.28.895, Culture=neutral, PublicKeyToken=0ecfe41405c30fb3              
                                                                                                                                           29c5ff3e-73bd-44bb-9fc8-5a81fa640499                                                                                                                                                Configured Instance of HSTM.HLC.BusinessLogic.Validators.ProfileActivityElememntValidator, HSTM.HLC.BusinessLogic, Version=13.1.28.895, Culture=neutral, PublicKeyToken=0ecfe41405c30fb3              

the validator gets an error like this 

StructureMap Exception Code:  202
No Default Instance defined for PluginFamily HSTM.HLC.BusinessLogic.IValidator`1[[HSTM.HLC.BusinessLogic.HCC.ProfileActivityElement, HSTM.HLC.BusinessLogic, Version=13.1.28.895, Culture=neutral, PublicKeyToken=0ecfe41405c30fb3]], HSTM.HLC.BusinessLogic, Version=13.1.28.895, Culture=neutral, PublicKeyToken=0ecfe41405c30fb3

That's the full error, no inner errors.  Perhaps I'm just overlooking some syntax error.
Thanks for the help,
Raif

Oh, And I cross post this to stackoverflow, I don't know if that's bad edicate or what.  what do you think?

Kim Johansson

unread,
Mar 7, 2013, 11:34:44 AM3/7/13
to structure...@googlegroups.com
> --
> You received this message because you are subscribed to the Google
> Groups "structuremap-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to structuremap-us...@googlegroups.com.
> To post to this group, send email to structure...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/structuremap-users/-/fBvS0w179WgJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
How did you add it?

It could be that it doesn't understand that that class should be used
for that interface.

--
Kim Johansson

Raif

unread,
Mar 7, 2013, 1:31:04 PM3/7/13
to structure...@googlegroups.com
Inside the assembly that contains both the interface and the concrete type I have a reg file that says
 Scan(x =>
            {
                x.TheCallingAssembly();
                x.ConnectImplementationsToTypesClosing(typeof(IValidator<>));

Raif

unread,
Mar 7, 2013, 3:22:00 PM3/7/13
to structure...@googlegroups.com
So, I'm in the code now and what I see is that the PluginFamilies have all the expected factories including the 10 or 12 open generic Interfaces that I want to use, however in the profile, from when the instance is pulled, the _instances field has about 50 less items, and has none of the open generics I need.  I'm looking at how the _instances field gets populated and why it's not getting the remaining cases.  If anyone has any pointers that would be cool.
Thanks,
R

Kevin Miller

unread,
Mar 7, 2013, 5:38:35 PM3/7/13
to structure...@googlegroups.com
I have a pull request that fixed something like this. Not sure if it has made it into a release yet. 



KevM 


--
You received this message because you are subscribed to the Google Groups "structuremap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to structuremap-us...@googlegroups.com.

To post to this group, send email to structure...@googlegroups.com.

Kevin Miller

unread,
Mar 7, 2013, 5:39:53 PM3/7/13
to structure...@googlegroups.com
Oops forgot to give you the workaround:  https://gist.github.com/KevM/3973710

KevM 

Raif

unread,
Mar 8, 2013, 9:14:48 AM3/8/13
to structure...@googlegroups.com
Very nice,
Thank you for this fix.  For the record it seems to have done the trick.  Now I can relax and go in and see what was going on.  I mean there is already ConnectImplementationsToTypesClosing() so either that does something else and I just think it registers open generics or there is an error with it.  Further confusing the issue, is that I have a couple of personal, non-plague-ridden apps that use that method for opengenerics and they work like a dream.  odd.
Anyway, thanks Kevin.
R

KevM 


To unsubscribe from this group and stop receiving emails from it, send an email to structuremap-users+unsub...@googlegroups.com.

To post to this group, send email to structure...@googlegroups.com.

Kevin Miller

unread,
Mar 8, 2013, 9:53:31 AM3/8/13
to structure...@googlegroups.com
This regression was I introduced in 2.6.4 so maybe your other apps use 2.6.3?

The PR was pulled and hopefully there will be a maintenance release or we can wait for 3.0. 
To unsubscribe from this group and stop receiving emails from it, send an email to structuremap-us...@googlegroups.com.

To post to this group, send email to structure...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
KevM 

Raif

unread,
Mar 8, 2013, 12:05:56 PM3/8/13
to structure...@googlegroups.com
actually I was using 2.6.1 in both, then I upgraded to 2.6.3 to see if it had been addressed but it acted the same.  I am registering my assemblies differently in the two apps.  In one I have the bootstrapper in the web app and reference all the dlls via AssembliesContainingType (or whatever the syntax is).  The problematic app has a reg in each of many assemblies. 
Regardless it works now, and I eagerly await 3.0
r

KevM 


To unsubscribe from this group and stop receiving emails from it, send an email to structuremap-users+unsubscribe@googlegroups.com.

To post to this group, send email to structure...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/structuremap-users/-/6rRYPOfALHEJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "structuremap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to structuremap-users+unsub...@googlegroups.com.
To post to this group, send email to structuremap-users@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/structuremap-users/-/XC4umpmm1MIJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
KevM 
Reply all
Reply to author
Forward
0 new messages