Open Closed

Injected IAuditLogRepository logic does not work anymore #3284


User avatar
0
alexander.nikonov created

ABP Framework version: v5.1.2 UI type: Angular DB provider: EF Core Identity Server Separated (Angular)

Hello

I use the class implementing IAuditingStore interface to catch all the errors in our application. I would like to use this class as a proxy: for this I inject ABP object implementing IAuditLogRepository interface.

I've faced the issue while trying to save an error (It looks like task has been canceled by ABP logic) - see the picture attached:

This logic used to work well on the previous versions of ABP framework. What is wrong now?


8 Answer(s)
  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi, thanks for the explanation. I'll check and write you back asap.

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    I've created an application with v5.0 and implemented the IAuditingStore interface and save records by using the IAuditLogRepository. Then, upgraded the application to v5.1.2 and I still could save records to the database and didn't face with any problems.

    Can you share your class that implements the IAuditingStore?

  • User Avatar
    0
    alexander.nikonov created

    This issue can be reproduced when you are trying to save some error (the exception which happens in your application). Have you reproduced this case?

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    This issue can be reproduced when you are trying to save some error (the exception which happens in your application). Have you reproduced this case?

    Yes, I tried in that case but couldn't reproduce the problem. If it's possible can you share your class that implements the IAuditingStore?

  • User Avatar
    0
    alexander.nikonov created

    Unfortunately, I cannot share the source code, but I'll try to describe what I've found out.

    I've revealed that the issue happens when I am trying to modify HttpContext response stream. I have to return custom JSON response when my application throws an exception. For this goal, the middleware has been created. It analyzes HttpContext response headers and replaces this response stream - when an exception happens - with custom JSON response. The middleware uses IAuditingManager to collect the information about errors.

    Do you have any idea how modifying HttpContext response stream may affect IAuditLogRepository logic?

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Unfortunately, I cannot share the source code, but I'll try to describe what I've found out.

    I've revealed that the issue happens when I am trying to modify HttpContext response stream. I have to return custom JSON response when my application throws an exception. For this goal, the middleware has been created. It analyzes HttpContext response headers and replaces this response stream - when an exception happens - with custom JSON response. The middleware uses IAuditingManager to collect the information about errors.

    Do you have any idea how modifying HttpContext response stream may affect IAuditLogRepository logic?

    Hi, actually it shouldn't affect the repository, but I'll check and write you back asap.

  • User Avatar
    0
    alexander.nikonov created

    Your bot has closed these ticket again. How to prevent this?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @alexander

    Unfortunately, I cannot share the source code

    Please use the template project to reproduce the problem and share it liming.ma@volosoft.com

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35