The constraint reference ‘string’ could not be resolved to a type. (netcoreapp3.0)

In case you use something like

[HttpGet("example/{param1:string}/{param2:Guid}")]

change it to

[HttpGet("example/{param1}/{param2:Guid}")]

because “:string” is actually interpreted as a regex-validation-constraint and not a type definition and guess what, everything is reaching the server as string and there is no string-regex-validator 🙂

Leave a Comment