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

Method 'TriggerFired' in type 'CrystalQuartz.Core.Quartz2.Quartz2SchedulerEventSource' from assembly 'CrystalQuartz.AspNetCore, #79

Open
guazilalala opened this issue Aug 2, 2019 · 1 comment

Comments

@guazilalala
Copy link

guazilalala commented Aug 2, 2019

Unable to load one or more of the requested types.
Method 'TriggerFired' in type 'CrystalQuartz.Core.Quartz2.Quartz2SchedulerEventSource' from assembly 'CrystalQuartz.AspNetCore, Version=6.8.1.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

public static Type[] GetAllTypes(this AppDomain @this, bool fromCache = true)
    {
        if (fromCache && (typeCache == null || !typeCache.Any()) || !fromCache)
        {
            typeCache = @this.GetExcutingAssemblies()
                .SelectMany(x =>
                {
                    try
                    {
                        return x.DefinedTypes.Select(t => t.AsType()); // Throw System.Reflection.ReflectionTypeLoadException
					}
                    catch (ReflectionTypeLoadException ex)
                    {
                        return ex.Types.Where(t => t != null);
                    }
                }).ToArray();
        }

        return typeCache;
}
@guryanovev
Copy link
Owner

guryanovev commented Sep 6, 2019

Please try to exclude CrystalQuartz assemblies from the scan like this:

@this.GetExcutingAssemblies().Where(x => !x.FullName.StartsWith("CrystalQuartz"))

In general it's a good practice to scan only your internal assemblies (unless you really need all the external classes):

assemblies.Where(x => x.FullName.StartsWith("MyRootAssemblyPrefix"))

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

No branches or pull requests

2 participants