Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Maximum call stack size exceeded #123

Closed
Anaster666 opened this issue Oct 6, 2021 · 6 comments
Closed

Error: Maximum call stack size exceeded #123

Anaster666 opened this issue Oct 6, 2021 · 6 comments
Labels
🐛 bug Something isn't working

Comments

@Anaster666
Copy link

Good morning,

I have a DDD project in .netCore in differents projects. I have configured the asyncApi and it works because the annotations are in the controller. But when I add this annotations in "Application" shape and modify the assembly taking one class of all the project I have this error:

Error: Maximum call stack size exceeded

I have this structure:

StartUp:

(...)
options.AssemblyMarkerTypes = new[] { typeof(MotorApplication) };  //this is one of the differents classes in the project application
(...)

ProjectApplication:

[AsyncApi]
    public class SyncMotor : DomainEventHandler<MotorDomainEvent>
    {

        public SyncMotor ()
        {
        }

        [Channel("Automotion/v1/MotorDocuments/Sync", BindingsRef = "service-amqp-binding")]
        [PublishOperation(typeof(IntegrationEvent), Summary = "")]
        public override Task Handle(MotorDomainEvent notification, CancellationToken cancellationToken)
        {
        }
    }

Thanks!!!

@m-wild
Copy link
Collaborator

m-wild commented Oct 6, 2021

Hmmm 🤔 does your IntegrationEvent have a circular reference?
Can you confirm which version of Saunter you are using?

@m-wild m-wild added the 🐛 bug Something isn't working label Oct 6, 2021
@Anaster666
Copy link
Author

Anaster666 commented Oct 9, 2021

Hiii!!

I have detect the problem, is the class Exception of .netCore. If the class have one attribute of this class I will have the error of "maximum call stack".

I send you my test:

`
[AsyncApi]
public class SyncDocumentIntegrationEventWhenUserPictureProfileDeletedDomainEventHandler : DomainEventHandler
{

    private readonly IIntegrationEventBus _integrationEventBus;

    public SyncDocumentIntegrationEventWhenUserPictureProfileDeletedDomainEventHandler(IIntegrationEventBus integrationEventBus)
    {
        _integrationEventBus = integrationEventBus;
    }


    [Channel("BArchive/v1/BusinessDocuments/DeleteUserFile", BindingsRef = "service-amqp-binding")]
    [PublishOperation(typeof(HolaClass), Summary = "Inform about user picture profile is deleted.")]
    public override Task Handle(UserPictureProfileDeletedDomainEvent notification, CancellationToken cancellationToken)
    {
        return Task.CompletedTask;
    }
}

public class HolaClass
{
    public int holaaa { get; set; }
    public Exception ex { get; set; }

    public HolaClass(int userId) 
    {
    }

}`

The version is 0.8.0

Thanks for the help!

@m-wild
Copy link
Collaborator

m-wild commented Oct 16, 2021

Just had a deeper look into this. From your test case the asyncapi.json document is being generated correctly, but the AsyncAPI UI is unable to render it.

As a minimal example the following will produce the Maximum call stack size exceeded error.

asyncapi: 2.2.0
info:
  title: Streetlights API
  version: 1.0.0
channels:
  publish/light/measured:
    publish:
      operationId: MeasureLight
      message:
        payload:
          $ref: '#/components/schemas/lightMeasuredEvent'
        name: lightMeasuredEvent
components:
  schemas:
    lightMeasuredEvent:
      id: lightMeasuredEvent
      type: object
      properties:
        ex:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/exception'
    exception:
      id: exception
      type: object
      properties:
        Message:
          type: string
        InnerException:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/exception'  # <--- if we remove this self-reference, the UI renders fine.

I will raise this issue with the asyncapi team.

@m-wild
Copy link
Collaborator

m-wild commented Aug 22, 2022

This has been fixed by the asyncapi team and updated in Saunter #144

@m-wild m-wild closed this as completed Aug 22, 2022
@m-wild
Copy link
Collaborator

m-wild commented Aug 22, 2022

Fixed in v0.10.0 https://www.nuget.org/packages/Saunter/0.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants