Skip to content

Conversation

@K0lb3
Copy link

@K0lb3 K0lb3 commented Jun 2, 2025

This PR slightly changes the behavior of MonoCecilTempGenerator.GetTemplateField.
So far this function checked if the given assembly string corresponds to an existing .dll within the managed path.
This effectively prevents adding assemblies in other ways, e.g. from memory, or from different paths.

With this PR, the function first checks if the given assembly string corresponds to an already loaded assembly, and only if not, tries to load it from a file within the managed path.

@K0lb3
Copy link
Author

K0lb3 commented Jun 2, 2025

I guess that alternatively it would be enough to simply remove the File.Exists(assemblyPath) path check in combination with wrapping the Read function in a try/catch.
This would also allow to cover the case of the assembly in question producing an error on being read by AssemblyDefinition.ReadAssembly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant