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

System.InvalidCastException in TicketCancelResponse.Acknowledge #16

Open
aaubry opened this issue Feb 13, 2024 · 0 comments
Open

System.InvalidCastException in TicketCancelResponse.Acknowledge #16

aaubry opened this issue Feb 13, 2024 · 0 comments

Comments

@aaubry
Copy link

aaubry commented Feb 13, 2024

We are getting a System.InvalidCastException while using the SDK:

Unable to cast object of type 'Sportradar.MTS.SDK.Entities.Internal.TicketImpl.Ticket' to type 'Sportradar.MTS.SDK.Entities.Interfaces.ITicketCancel'

It happens at this location:

        public void Acknowledge(bool markAccepted = true)
        {
-           var sentTicket = (ITicketCancel)_ticketCancelSender.GetSentTicket(TicketId);
            if (sentTicket == null)
            {
                throw new InvalidOperationException("Missing ticket in cache");
            }
            Acknowledge(markAccepted, sentTicket.BookmakerId, Reason.Code, Reason.Message);
        }

This code assumes that the cast to ITicketCancel is legal, but in this case the method is returning an instance of Sportradar.MTS.SDK.Entities.Internal.TicketImpl.Ticket, which doesn't implement that interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant