Overall this change seems wrong to me. CustomAttributeInstanceReadContext already checks to see if the schema is pruned but it doesn't communicate this information back out to the deserialization code so it doesn't know how to handle it.
I think you could find some way to wiggle some better status information out from the _FindSchemaCP method to the InstanceXmlReader.GetInstance method. That way you would only have to parse the schema name and scan the pruned schema list once per CA instead of twice. Haven't thought through the right way to do it but it seems possible with some refactoring.
Overall this change seems wrong to me. CustomAttributeInstanceReadContext already checks to see if the schema is pruned but it doesn't communicate this information back out to the deserialization code so it doesn't know how to handle it.
I think you could find some way to wiggle some better status information out from the
_FindSchemaCP
method to theInstanceXmlReader.GetInstance
method. That way you would only have to parse the schema name and scan the pruned schema list once per CA instead of twice. Haven't thought through the right way to do it but it seems possible with some refactoring.