hammett wrote:
> We went into similar ideas on MEF. The fact that it has an Export<>
> class almost enable your code snippet. We do have a ReleaseExport on
> the container
>
> var export = container.GetExport<IService>();
> var service = export.GetExportedObject();
> service.DoSomething();
> container.ReleaseExport(export); // or if you have the guts: (service
> as IDisposable).Dispose();
>   
Sure that will work; I would prefer to be able to use the using pattern 
(export here should implement IDisposable) because I think it makes it 
very clear what is going on, but this seems to solve the problem.
> On Wed, Mar 4, 2009 at 1:36 PM, Bill Barry <[email protected]> wrote:
>   
>> The generated proxies can be written in such a way that if the object is
>> disposed of in the finalizer instead of being explicitly disposed, an
>> exception could be thrown (at least I hope this could be possible while
>> the program is running in debug mode).
>>     
>
> You cannot throw on finalizer. That can kill the finalizer thread.
You could do it in a debugging mode (perhaps not DEBUG, but maybe a 
local mode where you define a "CatchContainerMistakes" option), where 
you have VS available (it would be horrid to ship such code, but when 
running it inside of visual studio I don't think it would be that big of 
a deal).

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" 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/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to