5

I have weird error, searching for solution is particularly hard, because it contains special characters.

I have a class library, that I add as a reference to C# project. It has a function(this is created by VS automatically, from metadata):

public static void StartReadingDAQ(int dATALength, out double[] dAQData, out double samplingRate, out string errorMessage);

So the declaration looks fine(note the second argument).

Then when trying to call the function:

double[] xxx = new double[_DATALength];
StartReadingDAQ(_DATALength, out xxx, out _SamplingRate, out _ErrorMessage);

I get compilation error:

Error   CS1503  Argument 2: cannot convert from 'out double[]' to 'out double[*]'   

What does it even mean? This is the first time I see a C# construction like double[*].

Dmitry
  • 13,797
  • 6
  • 32
  • 48
fike
  • 51
  • 1
  • 1
    `double[*]` is the type of a nonzero-based single dimensional array of double element type. It's not directly supported in C# so the generated metadata can be misleading. Is the class library compiled from another language maybe? – György Kőszeg Sep 09 '21 at 16:23
  • 1
    The "autogenerated from metadata" bit I think needs more description because this error message isnt reproducable with obvious/naive code: https://dotnetfiddle.net/BFhRHC – Jamiec Sep 09 '21 at 16:27
  • 2
    One thought - have you tried just `out var xxx` without defining `xxx` at all? – Jamiec Sep 09 '21 at 16:28
  • Does this answer regarding what a double[*] is help at all?https://stackoverflow.com/a/23196890/4708150 – TJ Rockefeller Sep 09 '21 at 16:31
  • @GazTheDestroyer The instance will never be read from. The variable will simply be assigned to without reading the variable's value, so the variable's value will never matter. The rules for an `out` param *require* that to be the case. – Servy Sep 09 '21 at 16:32
  • Well, I decompiled the class library, the mentioned function uses just "double[]" array. Anyway, the library depends on some LabView VIs, that were not in the repository together with the library, so even if I manage to compile it or just recompile the library from decompiled source code(it was written by the company I work for, so it is fine to deceompile/recompile), it gives me nothing without the VIs. I am trying to locate the original source, if not I will have to rewrite the whole thing from scratch. I appreciate all the help :) – fike Sep 09 '21 at 17:46

0 Answers0