Open vvdb-architecture opened 3 months ago
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.
@vvdb-architecture / @danchristensen2000 - I don't know if you are still trying to solve this, but we ran into what appears to be a very similar error that I noted here https://github.com/RicoSuter/NSwag/issues/4918
We were able to track down the trigger by running our web api in the debugger with it set to stop on all exceptions. Launch a browser to the swagger.json URL. This caused it to stop in the debugger at that location. By looking at what variables we could see in the debugger (particularly in Namotion.Reflection.ContextualType.Fields.get(), the base.Type pointed directly to the Action type in question), we were able to get a clue as to where this was coming from.
As with you, this issue began appearing after updating from nswag v13 to v14.
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?