question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure Functions issue?

See original GitHub issue

I’m creating an Azure Function to act as a backend for an Alexa skill.

All I’ve done so far in Visual Studio:

  1. File -> New Azure Functions project
  2. Add new Azure Function
  3. Add AlexaSkillsKit.NET with NuGet
  4. Create a shell of a Speechlet implementation
  5. Add the minimum code to the Azure Function to process the speechlet

When I compile, I get an error:

Could not load file or assembly ‘Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies. The system cannot find the file specified.

But according to NuGet in Visual Studio, it’s not trying to use 7.0.0.0, it’s using 9+. I’ve tried updating and downgrading the JSON.net package. I’ve tried Clean/Rebuild/restarting from scratch.

I thought that maybe assembly binding might be the answer, but there’s no Web.config or App.config in an Azure Functions project.

What am I missing? How do I get rid of this error?

Speechlet code:

public class MySpeechlet : SpeechletBase, ISpeechletWithContextAsync
{
    public Task<SpeechletResponse> OnIntentAsync(IntentRequest intentRequest, Session session, Context context)
    {
        throw new System.NotImplementedException();
    }

    public Task<SpeechletResponse> OnLaunchAsync(LaunchRequest launchRequest, Session session, Context context)
    {
        throw new System.NotImplementedException();
    }

    public Task OnSessionStartedAsync(SessionStartedRequest sessionStartedRequest, Session session, Context context)
    {
        throw new System.NotImplementedException();
    }

    public Task OnSessionEndedAsync(SessionEndedRequest sessionEndedRequest, Session session, Context context)
    {
        throw new System.NotImplementedException();
    }
}

Azure Function:

public static class MyFunction
{
    [FunctionName("MyFunction")]
    public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log)
    {
        var speechlet = new MySpeechlet();
        return await speechlet.GetResponseAsync(req);
    }
}

I think this may be an issue with the Azure Functions SDK, but is there some way to workaround it?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ElvenMonkycommented, Feb 23, 2018

Finally I had to deal with this error, as I was unable to publish my Function to Azure.

It seems to be a known issue in Azure function generator.

The solution is to mark your custom speechlet class as internal. Alternatively, you can move speechlet class to separate project as mentioned by @mgroves

Note: To make speechlet visible for unit tests project, add AssemlyInfo.cs to Function’s Properties folder and put [assembly: InternalsVisibleTo("MySkill.UnitTests")] attribute there.

1reaction
ElvenMonkycommented, Feb 8, 2018

Can we close it, as it is more of Azure issue and there is not much we can do, apart from releasing .Net Core library version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · Azure/Azure-Functions
Azure Function Service Bus trigger goes idle when no messages are present in the Topic (Consumption Plan) Needs: Triage (functions).
Read more >
Troubleshoot error: Azure Functions Runtime is unreachable
This issue occurs when the Functions runtime can't start. The most common reason for this is that the function app has lost access...
Read more >
Azure Functions diagnostics Overview
Start Azure Functions diagnostics · Navigate to your function app in the Azure portal. · Select Diagnose and solve problems to open Azure ......
Read more >
Azure Functions error handling and retry guidance
Handling errors in Azure Functions is important to help you avoid lost data, avoid missed events, and monitor the health of your application....
Read more >
Troubleshoot Python errors in Azure Functions
This error occurs when a Python function app is forced to terminate by the operating system with a SIGSEGV signal. This signal indicates ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found