[Python.NET] assemblymanager and reflection only assemblies

brad at fie.us brad at fie.us
Sat Oct 27 04:38:04 CEST 2012


fyi:  I ran into a bug and fixed it… I think?

Some thoughts on what I did?

I am writing an application that loads plugins.  As part of that, it first loads the plugin assembly in "reflection only" mode.

pythonnet's assemblymanager.cs registers a handler at line 54.

it gets called when I load the assembly… even in reflection mode.  Which I think is correct.

the handler begins at line 88.

it was throwing an exception when it tries to "ScanAssembly()" on the passed assembly.  More specifically when it tried to load the types.

If I'm reading the code right, it should not attempt to scan the assembly because it is loaded reflection only.  One can check this with the "ReflectionOnly" property of the provided assembly.  So I surrounded the rest of the code in a "if" conditional and only add the assembly and scan it, if it is not "RefelctionOnly."

Is that the right thing to do?  It's gotten rid of my problem.  But I wonder if its strictly correct to both not add it to the assemblies collection in the manager and also not scan it.

Thoughts?  I don't want to submit a patch if it's not really the right approach to the matter.


More information about the PythonDotNet mailing list