| Author |
Message |
clement_911
Joined: 22 Dec 2010 Posts: 7 Location: AU
|
Posted: Wed Dec 22, 2010 10:29 am Post subject: Assembly embedding with MEF ? |
|
|
Hi
I have tried the assembly embedding functionality in my Silverlight Application but it does not seem to play well with MEF.
When the code reaches "CompositionInitializer.SatisfyImports(this);", the import is failing and throws an exception.
My guess is that MEF cannot find the type because it belong into an embedded assembly, which has not been used so far.
From what I've read, the embedding feature will load the embedded assembly when it is first used. Then I guess a work around would be to force all embedded assemblies to be loaded as soon as the application starts.
Is it possible to achieve ???????
Cheers |
|
| Back to top |
|
 |
ShortAngry
Joined: 02 Dec 2010 Posts: 14
|
|
| Back to top |
|
 |
clement_911
Joined: 22 Dec 2010 Posts: 7 Location: AU
|
Posted: Thu Dec 23, 2010 11:58 am Post subject: |
|
|
The link you provided is about a different problem.
It would be good if it was possible to have embedded assemblies be loaded as normal dependencies rather than specially treated.
MEF and other API would then work out of the box with them. |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6347 Location: Red Gate Software
|
Posted: Thu Dec 23, 2010 2:49 pm Post subject: |
|
|
Hi,
Embedded assemblies should bind in exactly the same way as before they were embedded. I think the issue you have is with obfuscation changing the names of methods and properties. Try it without obfuscation and see if it works.
Microsoft seems to be breaking its' own rules are invoking private methods in DLLs and that is wreaking havoc with smartassembly-obfuscated methods because we assume private methods are not going to be called using Reflection. At least this is the case with Silverlight so probably with MEF as well.
Bottom line is if you are using any technology that leverages reflection, you have to do a heckuva lot of testing after you obfuscate it and you have to know the technologies you're working with at a pretty in-depth level. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
clement_911
Joined: 22 Dec 2010 Posts: 7 Location: AU
|
Posted: Thu Dec 23, 2010 9:14 pm Post subject: |
|
|
I see.
As far as I know, MEF is just a library and is limited to the same silverlight rules as everyone (it's even open sourced).
I think it relies on loading all the assemblies in the manifest file. However, apparently a new manifest file is created when embedding assemblies, so that might be why MEF is not able to find the types on the dependencies. |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6347 Location: Red Gate Software
|
Posted: Fri Dec 24, 2010 10:24 am Post subject: |
|
|
I'm vaguely aware that you can have problems when you have DLL assemblies that contain nothing but type declarations. Is that how you're working as well? _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
|