Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.net core Type must not be ByRef Parameter name: type

when i run this method it shows below error,

public bool SaveDocument(out string newDocumentNo, ReciptUpdate reciptUpdate)
{
    newDocumentNo = "MB120055";
    return true;            
}

The error is

ArgumentException: Type must not be ByRef
Parameter name: type

like image 772
sandun Avatar asked May 30 '26 21:05

sandun


1 Answers

I got this same error message because I added an "in" modifier to a controller method when tinkering with some optimisation and didn't notice that it broke the aspnet.core runtime invocation of the method (resulting in this somewhat cryptic error)

The original method signature:

public IActionResult ReceiveMessage(string topicName, [FromBody] in CloudEvent update)

The fix:

public IActionResult ReceiveMessage(string topicName, [FromBody] CloudEvent update)
like image 113
Nathan Avatar answered Jun 01 '26 09:06

Nathan