Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The invoked member is not supported in a dynamic assembly. #225

Closed
takinosaji opened this issue Nov 1, 2016 · 2 comments
Closed

The invoked member is not supported in a dynamic assembly. #225

takinosaji opened this issue Nov 1, 2016 · 2 comments
Assignees
Milestone

Comments

@takinosaji
Copy link

In different applications when using kernel.Load(AppDomain.CurrentDomain.GetAssemblies()); receiving an error: The invoked member is not supported in a dynamic assembly.

Detailed string:

Type = System.NotSupportedException
Message = The invoked member is not supported in a dynamic assembly.
Source = mscorlib
TargetSite = System.Type[] GetExportedTypes()
StackTrace = at System.Reflection.Emit.InternalAssemblyBuilder.GetExportedTypes()
at Ninject.Infrastructure.Language.ExtensionsForAssembly.GetNinjectModules(Assembly assembly)
at Ninject.KernelBase.b__2(Assembly asm)
at System.Linq.Enumerable.d__162.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Ninject.KernelBase.Load(IEnumerable1 m) at Ninject.KernelBase.Load(IEnumerable1 assemblies)
at Dolphin.Host.Startup.CreateKernel() in .....
HResult = -2146233067

@AngusMcIntyre
Copy link

This error is occurring because Assembly.Load cannot be called upon dynamic assemblies. You must filter out the dynamic assemblies before using them.

kernel.Load(AppDomain.CurrentDomain.GetAssemblies().Where(p => !p.IsDynamic));

thegaragelab added a commit to thegaragelab/TheGarageLab.Depends that referenced this issue Aug 22, 2017
@scott-xu scott-xu self-assigned this Sep 16, 2017
@scott-xu scott-xu added this to the 4.0 milestone Sep 16, 2017
@scott-xu scott-xu modified the milestones: 4.0, 3.3.0 Sep 23, 2017
@elprotto
Copy link

elprotto commented Jul 1, 2020

Works for me!

glenkeane-94 pushed a commit to glenkeane-94/Nin-ject that referenced this issue Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants