I have the CompositionException exception with this message: "The ComposablePart of type 'SomeService' cannot be recomposed because it is in an invalid state. It can only be recomposed if it has already been fully previewed or composed."
Exception is thrown by this code:
public class SomeService : ISomeService
{
[Import(typeof(ISomeType))]
public ISomeType SomeType { get; set; }
public SomeService()
{
Container.ComposeParts(this);
}
}
but everything fine with this:
public class SomeService : ISomeService
{
[Import(typeof(ISomeType))]
public ISomeType SomeType { get; set; }
public SomeService()
{
this.SomeType = Container.GetExportedValue<ISomeType>();
}
}
I have this code "Container.ComposeParts(this)" in other places and it works but here it doesn't.
I didn't found nothing interesting after googling with "cannot be recomposed because it is in an invalid state".
What does this message mean? Thank you!
This might be because you are using the CompositionContainer from multiple threads. Are you diong that?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With