Skip to content
This repository has been archived by the owner on Mar 21, 2019. It is now read-only.

assembly.DefinedTypes in the FindServiceTypeByPath method of Discoverator.cs can cause a crash #68

Open
bezz92 opened this issue Oct 17, 2014 · 1 comment
Labels

Comments

@bezz92
Copy link

bezz92 commented Oct 17, 2014

The problem is here:

        foreach (Assembly assembly in allAssm)
        {
            foreach (TypeInfo ti in assembly.DefinedTypes)
            {
                SwaggeratedAttribute da = ti.GetCustomAttribute<SwaggeratedAttribute>();
                if (da != null && da.LocalPath == servicePath)
                {
                    return ti.AsType();
                }
            }
        }

While looping through all assemblies in my local domain one of them happens to have a count of 0 TypeInfo in it's DefinedTypes (I believe that was the problem, otherwise the DefinedTypes property of that assembly is just in a weird state). This ends up crashing the Discoverator. Before "foreach (TypeInfo ti in assembly.DefinedTypes)" there should be some kind of check to see if it'll be possible to loop over the DefinedTypes.

@superstator
Copy link
Owner

Thanks - I'm still waiting for free time to finish a major cleanup, hopefully I can roll this in too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants