Hutchison, an online troubleshooting: C # parameter is optional pit

Online reported that a number of exceptions, the error message is: Can not find way to achieve XX

 

Code calls the relationship is:

 

 

View Code history, found recently on the front line that has been modified to GetUserDottedLineSuperiors method adds an optional parameter.

 

 

After confirming with the students related development, is on the line UserService.dll Hotfix way, there is no full-page publication (in a test environment to verify when the full-page publication).

Ordinarily, where the code is changed, you only need to update the dll code is located, is only updated UserService.dll is nothing wrong in.

But , this is not right.

We are look DataRule.dll source and the anti-compiled code:

 

 

 Code (the figure) is maintained as it was before adding optional parameters, because of the existence of optional parameters, the compiler no problem at all.

 

However, decompile (above), was found to increase the compiler optional parameter a default value.

Although DataRule project description in code Although it did not move, but dll compiled with before actually not the same. It is necessary to update this DataRule.dll.

It can also peep about the C # implementation of optional parameters, plus the actual point of call is the default value of the parameter.

--------------------------------------------------------------------------------------------------------------------------------

In fact, the beginning, I also curious, because look IL, indeed optional parameter to increase the [OPT] label, supposedly should work

 

 Followed by time to check MethodTable, I guess it should be MethodTable in this method are three parameters, and the point of call should also address methods to check MethodTable three parameters corresponding because local calls, IL is:

 

 To jump to address is indeed a method corresponding to the three parameters

 

Guess you like

Origin www.cnblogs.com/cc299/p/11520806.html