Skip to content

Commit 78fc9c4

Browse files
committed
For VS tooling case, give an error if user has a method in their code (with attributes), but deletes the generated Function.json.
See #1732
1 parent 595ac62 commit 78fc9c4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/WebJobs.Script.WebHost/Diagnostics/FunctionInstanceLogger.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ internal FunctionInstanceLogger(
7171
string shortName = Utility.GetFunctionShortName(item.FunctionName);
7272

7373
FunctionDescriptor descr = _funcLookup(shortName);
74+
if (descr == null)
75+
{
76+
// This exception will cause the function to not get executed.
77+
throw new InvalidOperationException($"Missing function.json for '{shortName}'.");
78+
}
7479
FunctionLogger logInfo = descr.Invoker.LogInfo;
7580
state = new FunctionInstanceMonitor(descr.Metadata, _metrics, item.FunctionInstanceId, logInfo);
7681

0 commit comments

Comments
 (0)