I encountered a strange compiler error in Delphi Prism 2010 that I am unable to resolve. The error is calling a method on an object defined in a third-party assembly that manipulates a specialized image format. The assembly itself was compiled against the .Net 2.0 Runtime.
Despite providing the correct list of parameters, I consistently get an error and series of warning messages indicating the parameter list is incorrect. The VS 2008 IDE also refuses to perform parameter completion, yet correctly shows the method prototype and allows the method to be added using Ctrl-Space. Below is an abbreviated version of the compiler errors to illustrate the problem:
Error 1 (PE19) There is no overloaded method "GetTempMapOfIRSensor" with these parameters
Warning 2 (PH2) Best matching "Image.GetTempMapOfIRSensor(var rectOnSensor: System.Drawing.Rectangle; out average: System.Double; out minTempArrayIndex: System.Int32; out maxTempArrayIndex: System.Int32; desiredTempUnits: Image.TEMP_UNIT): array of System.Double" doesn't match on parameter 1, parameter is "System.Drawing.Rectangle" should be "System.Drawing.Rectangle"
Warning 3 (PH2) Best matching "Image.GetTempMapOfIRSensor(var rectOnSensor: System.Drawing.Rectangle; out average: System.Double; out minTempArrayIndex: System.Int32; out maxTempArrayIndex: System.Int32; desiredTempUnits: Fluke.Thermography.TEMP_开发者_StackOverflow中文版UNIT): array of System.Double" doesn't match on parameter 2, parameter is "System.Double" should be "System.Double"
....a list of similar warnings for each remaining parameter
The strange part is that the compiler complains about a type mismatch for each and every parameter, yet the error message shows the parameter type names are the same (e.g. parameter is "System.Double" should be "System.Double").
Any suggestions on how to troubleshoot and resolve this issue would be welcome. The class in question, other than this one method, seems to work fine in every other respect. I am also able to create a method on the local class with the same signature and call it without error.
Update:
Invoking the method using reflection and the same parameter list works properly. This is looking to be a compiler bug/limitation of some sort.
If this library has overloads for non-var/out & var or out parameters with the rest of the signature the same, turn off the option for implicit out/var parameters and add out & var in the places they're needed. That should fix, else a QC entry generally is fixed quite fast, if it's a bug.
精彩评论