GithubHelp home page GithubHelp logo

anniekvandijk / toxicplants Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 4.63 MB

Api with http endpoint for matching phot's of plants with list of Toxic plants for a specific animal.

License: MIT License

C# 100.00%
azure-functions github-actions httptrigger sentry sonarcloud coverlet

toxicplants's People

Contributors

anniekvandijk avatar

Stargazers

 avatar

Watchers

 avatar  avatar

toxicplants's Issues

OpenApi: Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

[2021-11-14T10:17:29.412Z] One or more errors occurred. (Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.)
[2021-11-14T10:17:29.416Z] Result: One or more errors occurred. (Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.)
Exception: System.AggregateException: One or more errors occurred. (Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.)
[2021-11-14T10:17:29.417Z] ---> System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Internal.QueryCollection' from assembly 'Microsoft.AspNetCore.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[2021-11-14T10:17:29.418Z] at Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Extensions.OpenApiHttpRequestDataExtensions.Queries(HttpRequestData req)
[2021-11-14T10:17:29.420Z] at Microsoft.Azure.Functions.Worker.Extensions.OpenApi.HttpRequestObject..ctor(HttpRequestData req)
[2021-11-14T10:17:29.421Z] at Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Functions.OpenApiTriggerFunction.RenderSwaggerUI(HttpRequestData req, FunctionContext ctx)
[2021-11-14T10:17:29.421Z] at Microsoft.Azure.Functions.Worker.Extensions.OpenApi.DefaultOpenApiHttpTrigger.RenderSwaggerUI(HttpRequestData req, FunctionContext ctx)
[2021-11-14T10:17:29.422Z] --- End of inner exception stack trace ---
[2021-11-14T10:17:29.423Z] at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) [2021-11-14T10:17:29.423Z] at System.Threading.Tasks.Task1.get_Result()
[2021-11-14T10:17:29.424Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionInvoker2.<>c.<InvokeAsync>b__6_0(Task1 t) in D:\a\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionInvoker.cs:line 32
[2021-11-14T10:17:29.426Z] at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() [2021-11-14T10:17:29.427Z] at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) [2021-11-14T10:17:29.428Z] at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) [2021-11-14T10:17:29.429Z] --- End of stack trace from previous location --- [2021-11-14T10:17:29.430Z] at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) [2021-11-14T10:17:29.431Z] at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) [2021-11-14T10:17:29.431Z] --- End of stack trace from previous location --- [2021-11-14T10:17:29.432Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionContext context) in D:\a\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionExecutor.cs:line 44 [2021-11-14T10:17:29.436Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 [2021-11-14T10:17:29.437Z] at Function.MiddleWare.ExceptionHandler.ExceptionHandlerMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\Repositories\Persoonlijk\Github\Net\ToxicPlants\Function\MiddleWare\ExceptionHandler\ExceptionHandlerMiddleWare.cs:line 20 Stack: at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
[2021-11-14T10:17:29.439Z] at System.Threading.Tasks.Task1.get_Result() [2021-11-14T10:17:29.439Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionInvoker2.<>c.b__6_0(Task1 t) in D:\a\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionInvoker.cs:line 32 [2021-11-14T10:17:29.441Z] at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
[2021-11-14T10:17:29.444Z] at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
[2021-11-14T10:17:29.446Z] at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
[2021-11-14T10:17:29.447Z] --- End of stack trace from previous location ---
[2021-11-14T10:17:29.447Z] at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
[2021-11-14T10:17:29.448Z] at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[2021-11-14T10:17:29.452Z] --- End of stack trace from previous location ---
[2021-11-14T10:17:29.452Z] at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionContext context) in D:\a\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionExecutor.cs:line 44
[2021-11-14T10:17:29.453Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2021-11-14T10:17:29.454Z] at Function.MiddleWare.ExceptionHandler.ExceptionHandlerMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\Repositories\Persoonlijk\Github\Net\ToxicPlants\Function\MiddleWare\ExceptionHandler\ExceptionHandlerMiddleWare.cs:line 20.

Azure/azure-functions-openapi-extension#296

JsonOptions not working

s.AddControllers().AddJsonOptions(x =>
{
x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
x.JsonSerializerOptions.IgnoreNullValues = true;
});

Response still contains int and null

Create other way of error Response

When something goes wrong I want to stop the function execution and give an response. But

  • threr is no way I can call a function stop method
  • There is no way to alter the response

As long as this is not possible, I use the ExceptionHandlingMiddlware to stop the execution. But it is an anti-patern to use exceptions for this.

For now I made a seperate class ProgramError to make a diffrence between a exception

foreach (var animal in animals)
{
    if (Enum.TryParse(animal.Data, true, out Animal animalEnum))
    {
        _animalRepository.Add(animalEnum);
    }
    else
    {
        ProgramError.CreateProgramError(HttpStatusCode.BadRequest, "Animal not supported");
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.