Not seeing more related code, I could not say I understand exact purpose of the code you showed.
However, the error message is expected:
The "For Each..." loop goes through a drawing's block definitions to see whether a block definition exists in drawing.
So, MyBlock as declared as AcadBlock, not AcadBlockreference, therefore, MyBlock.EffectiveName is wrong and raises the exception.
A block definition, be it dynamic block or not, always has a name, while a block reference, if being a dynamic block reference, could have an "annomynous block" name, thus, a read-only "EffectiveName" is needed to indicate from which dynamic block definition it is derived.
It is obvious that the tool you get has a bug when dealing with dynamic block.