question

BeTheCode-5162 avatar image
0 Votes"
BeTheCode-5162 asked BeTheCode-5162 commented

How to fix 'does not exist in the current context'?

In following the tutorial



everything seems fine until the test run occurs and I get the following error:

run.csx(61,19): error CS0103: The name 'RunAvailabilityTestAsync' does not exist in the current context


All code was copied from the examples in the tutorial so what could be going wrong? Thanks.

azure-functionsazure-monitor
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PierreLucGiguere-5297 avatar image
0 Votes"
PierreLucGiguere-5297 answered

Hi BeTheCode,

I ran into the exact same problem while trying to replicate your issue. Turns out that App Service Editor truncated the runAvailabilityTest.csx to runAvailabilityTest.cs (missing the x). Why? I don't know, it just did.

Can you double-check the name of the files?

I did my troubleshoot based on the following article:

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0103

Don't forget to indicate if my answer solved your problem.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BeTheCode-5162 avatar image
0 Votes"
BeTheCode-5162 answered BeTheCode-5162 commented

Actually, I'm getting the same issue. Re-created all the files using the tutorial and checked all the names and still the same problem.

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Attached is a screen shot of the files showing the naming to be correct:135514-capture.png


0 Votes 0 ·
capture.png (23.3 KiB)

I'm glad you figured it out. It's sometimes just a little typo like this one that can cause people to get sucked.

0 Votes 0 ·
BeTheCode-5162 avatar image BeTheCode-5162 PierreLucGiguere-5297 ·

The problem still exists(removing IDs from error for privacy concerns):

2021-09-27T16:05:00.007 [Information] Executing 'Functions.TimerTrigger1' (Reason='Timer fired at 2021-09-27T16:05:00.0071197+00:00', Id=)

2021-09-27T16:05:00.033 [Error] Function compilation errorMicrosoft.CodeAnalysis.Scripting.CompilationErrorException : Script compilation failed.at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.CreateFunctionTarget(CancellationToken cancellationToken) at D:\a\1\s\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 321at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.WebJobs.Script.Description.FunctionLoader`1.GetFunctionTargetAsync[T](Int32 attemptCount) at D:\a\1\s\src\WebJobs.Script\Description\FunctionLoader.cs : 55at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.GetFunctionTargetAsync(Boolean isInvocation) at D:\a\1\s\src\WebJobs.Script\Description\DotNet\DotNetFunctionInvoker.cs : 193

2021-09-27T16:05:00.125 [Error] run.csx(1,8): error CS1504: Source file 'runAvailabilityTest.csx' could not be opened -- Could not find file.

2021-09-27T16:05:00.176 [Error] run.csx(63,19): error CS0103: The name 'RunAvailabilityTestAsync' does not exist in the current context

2021-09-27T16:05:00.226 [Error] Executed 'Functions.TimerTrigger1' (Failed, Id=, Duration=192ms)Script compilation failed.

0 Votes 0 ·

In your screenshot, the file is named 'runAvailabilityText.csx' (notice the X) and it should be 'runAvailabilityTest.csx' (notice the S).

The correct spelling for this tutorial is 'runAvailabilityTest.csx'.

Let me know if that works now.

0 Votes 0 ·
Show more comments