Azure / Azure/azure-functions-host

C# compilation service error: The operation was canceled.

Open
#2,098 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

I have been seeing this error randomly when having a C# compile error. I'm pretty sure I saw it on both Windows and Linux

```
2017-11-01T23:35:13.676 Microsoft.Azure.WebJobs.Script.Description.CompilationServiceException : C# compilation service error: The operation was canceled. ---> System.OperationCanceledException : The operation was canceled.
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive,Int32 toExclusive,ParallelOptions parallelOptions,Action`1 body,Action`2 bodyWithState,Func`4 bodyWithLocal,Func`1 localInit,Action`1 localFinally)
at System.Threading.Tasks.Parallel.For(Int32 fromInclusive,Int32 toExclusive,ParallelOptions parallelOptions,Action`1 body)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetDiagnostics(CompilationStage stage,Boolean includeEarlierStages,CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CompileMethods(CommonPEModuleBuilder moduleBuilder,Boolean emittingPdb,Boolean emitMetadataOnly,Boolean emitTestCoverageData,DiagnosticBag diagnostics,Predicate`1 filterOpt,CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Compilation.Emit(Stream peStream,Stream metadataPEStream,Stream pdbStream,Stream xmlDocumentationStream,Stream win32Resources,IEnumerable`1 manifestResources,EmitOptions options,IMethodSymbol debugEntryPoint,Stream sourceLinkStream,IEnumerable`1 embeddedTexts,CompilationTestData testData,CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Compilation.Emit(Stream peStream,Stream pdbStream,Stream xmlDocumentationStream,Stream win32Resources,IEnumerable`1 manifestResources,EmitOptions options,IMethodSymbol debugEntryPoint,Stream sourceLinkStream,IEnumerable`1 embeddedTexts,Stream metadataPEStream,CancellationToken cancellationToken)
at async Microsoft.Azure.WebJobs.Script.Description.CSharpCompilation.EmitAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\Compilation\CSharp\CSharpCompilation.cs : 103
End of inner exception
at async Microsoft.Azure.WebJobs.Script.Description.CSharpCompilation.EmitAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\Compilation\CSharp\CSharpCompilation.cs : 121
at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.CreateFunctionTarget(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 304
at async Microsoft.Azure.WebJobs.Script.Description.FunctionLoader`1.GetFunctionTargetAsync[T](Int32 attemptCount) at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\FunctionLoader.cs : 0
at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.GetFunctionTargetAsync() at C:\projects\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 185
2017-11-01T23:35:13.676 Function loader reset. Failed compilation result will not be cached.
```

Contributor guide

Open the contributing guide

Research direction

Start by inspecting src/WebJobs.Script/Description/DotNet/Compilation/CSharp/CSharpCompilation.cs around lines 103 and 121, then follow the calls from DotNetFunctionInvoker.cs around lines 185 and 304. Reproduce a C# compile error on the reported platforms and determine why compilation is canceled. Done should include a confirmed cause and a verified behavior for the failing compilation path.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.