We are almost there, but the `catch` section does not contain the double check like you've added inside the `try`

That's what I meant with adding the lock around the complete method body, to avoid needing to add that logic at 2 places, even though there might be a small , but negligible performance hit.

You can also lock on the `typesByAssembly` private field instead of the  `SyncRoot` since there is nothing outside the class that can access that field and then there is no need to cast