Skip to content

Commit 9828d85

Browse files
committed
Resolve #1867
1 parent 46f7b62 commit 9828d85

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/WebJobs.Script/Host/ScriptHost.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ private void VerifyPrecompileStatus(IEnumerable<FunctionDescriptor> functions)
562562
/// Get the set of types that should be directly loaded. These have the "configurationSource" : "attributes" set.
563563
/// They will be indexed and invoked directly by the WebJobs SDK and skip the IL generator and invoker paths.
564564
/// </summary>
565-
private static IEnumerable<Type> GetDirectTypes(IEnumerable<FunctionMetadata> functionMetadataList)
565+
private IEnumerable<Type> GetDirectTypes(IEnumerable<FunctionMetadata> functionMetadataList)
566566
{
567567
HashSet<Type> visitedTypes = new HashSet<Type>();
568568

@@ -578,8 +578,17 @@ private static IEnumerable<Type> GetDirectTypes(IEnumerable<FunctionMetadata> fu
578578

579579
Assembly assembly = Assembly.LoadFrom(path);
580580
var type = assembly.GetType(typeName);
581-
582-
visitedTypes.Add(type);
581+
if (type != null)
582+
{
583+
visitedTypes.Add(type);
584+
}
585+
else
586+
{
587+
// This likely means the function.json and dlls are out of sync. Perhaps a badly generated function.json?
588+
string msg = $"Failed to load type '{typeName}' from '{path}'";
589+
TraceWriter.Warning(msg);
590+
_startupLogger?.LogWarning(msg);
591+
}
583592
}
584593
return visitedTypes;
585594
}

0 commit comments

Comments
 (0)