Aura.Shared.Scripting.ScriptManager.GetJITtedTypes C# (CSharp) Method

GetJITtedTypes() protected static method

TODO: We might want to stop loading if this is a problem, scripts might depend on each other, which could lead to more errors.
protected static GetJITtedTypes ( Assembly asm, string filePath ) : IEnumerable
asm System.Reflection.Assembly
filePath string
return IEnumerable
		protected static IEnumerable<Type> GetJITtedTypes(Assembly asm, string filePath)
		{
			Type[] types;
			try
			{
				types = asm.GetTypes();
				foreach (var method in types.SelectMany(t => t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static)).Where(m => !m.IsAbstract && !m.ContainsGenericParameters))
					RuntimeHelpers.PrepareMethod(method.MethodHandle);
			}
			catch (Exception ex)
			{
				// Happens if classes in source or other scripts change,
				// i.e. a class name changes, or a parent class. Only
				// fixable by recaching, so they can "sync" again.

				Log.Exception(ex, "GetJITtedTypes: Loading of one or multiple types in '{0}' failed, classes in this file won't be loaded. " +
					"Restart your server to recompile the offending scripts. Delete your cache folder if this error persists.", filePath);

				// Mark for recomp
				try
				{
					new FileInfo(filePath).LastWriteTime = DateTime.Now;
				}
				catch
				{
					// Fails for DLLs, because they're loaded from where they are.
				}

				return Enumerable.Empty<Type>();
			}

			return types;
		}