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
help wanted: debugging exception inside NSwag 14 #4842
Comments
vvdb-architecture
changed the title
help wanted: debugging exception inside NSwag
help wanted: debugging exception inside NSwag 14
Apr 2, 2024
I have also run into this same error after upgrading from 13.20.0 to 14.0.7, and am stuck. I have no idea where the error is occurring. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I am trying to track down a problem when upgrading from NSwag 13 to NSwag 14. The error message I'm getting during the generation of the CSharp client using the post-build event:
is the following:
Now, I would love to know what type is causing the
GetGenericTypeDefinition()
to trip up and throw an exception.This worked perfectly with NSwag 13.
For this, I first implemented a processor that narrows down the method on the controller:
This is added as follows:
Sadly, a close inspection did not reveal anything that narrowed down the problem. In fact, before the offending controller is reached, a lot of other controllers and methods with generic types are handled without issue.
Next, I defined a schema processor:
... which I then injected using:
This did not tell me more. Just before the exception occurs, it writes:
I don't see the connection between a Guid and a a generic type. And in the type being handled, a Guid doesn't even occur.
I noticed in the above stack trace that one of the methods is:
... so I changed the
SchemaProc
implementation as follows:The reasoning is that by calling the method that occurs in the stack trace myself, I could trigger the exception and investigate from there.
Sadly, that didn't work: the body of the above
catch
is never executed.The only rational explanation is that the exception is thrown before
SchemaProc.Process
is being called.This makes me throw my hands up in the air and ask for help on this forum. What else is there to do? The controllers and their return types are very complicated, and systematically removing types "until it works" will take more time than I have.
Is there some kind of trace flag I can set to have more detailed information?
The text was updated successfully, but these errors were encountered: