signumsoftware / framework

Open Source framework for writing data-centric applications using the latest versions of .Net Core, C# (not-nullable), ASP.NET Web API, Typescript (strict), React, D3 and Sql Server or PostgreeSQL
https://www.signumsoftware.com/en/Framework
MIT License
221 stars 84 forks source link

Key 'Signum.Entities.Rest.RestLogEntity' (string) not found on ItemsDictionary #556

Closed ce-kkoziel closed 2 years ago

ce-kkoziel commented 2 years ago

obraz obraz

@olmobrutall Could you look at this exception and explain what wrong is? We are using framework from commit 18d765b6670020d13cea46110ba9ae8cec25e0c0

olmobrutall commented 2 years ago

I can give you some hint:

The RestLogFilter replaces the Reponse.Body from the default 'stream to http directly' to a buffered memory stream so we can save the result in request.ResponseBody =.

For some reason looks like context.HttpContext.Items[OriginalResponseStreamKey] is not found.

Maybe OnActionExecuting didn't execute?

olmobrutall commented 2 years ago

Hi @ce-kkoziel any progress with this?

ce-kkoziel commented 2 years ago

Hi @olmobrutall. You are right, I discover OnActionExecuting was not executed. But it means RestLogFilter does not handle requests which do not match to endpoint requirements (ModelState is invalid). Instead of that behavior it generates Exception like in issue. Currently, framework do not allow to log any info about rejected requests on model validation stage.

olmobrutall commented 2 years ago

Currently I think CE are the only using RestLogAttribute.

since looks like you can reproduce the problem, feel free to change it to fix the current behavior.

ce-kkoziel commented 2 years ago

If I had a permissions to push new branch with my fix I would make a pull request with my changes.

olmobrutall commented 2 years ago

Permission from who? You can fork framework repo, push to you cloned repo and make PR from there

ce-kkoziel commented 2 years ago

Ok, great! I will try to do in this way. :)