StefH / ProxyInterfaceSourceGenerator

This project uses Source Generation to generate an interface and a Proxy class for classes. This makes it possible to wrap external classes which do not have an interface, in a Proxy class which makes it easier to Mock and use Dependency Injection.
MIT License
38 stars 5 forks source link

2D arrays as inputs to a method generate interfaces with incorrect asterisks in their array definitions #54

Closed FatSwords closed 1 year ago

FatSwords commented 1 year ago

I have a class I want to create a proxy interface/proxy for. It has a method as below:

public void DoStuff(double input, [Out] double[,] output) { //Do some stuff }

Upon running the code generation, I get an interface which looks like this:

void DoStuff(double input, double[*,*] output);

which does not compile, and is missing the out keyword. It might be the combination of the out keyword and the 2D array which is causing the issue - not sure yet.

StefH commented 1 year ago

@FatSwords

The out should work fine : see https://github.com/StefH/ProxyInterfaceSourceGenerator/blob/390093d0076d7541f7363df3227d71e7c0c2cdaf/src-examples/ProxyInterfaceConsumerViaNuGet/PersonProxy2.cs#L61

Did you try your code as:

public void DoStuff(double input, out double[,] output) { //Do some stuff }

BTW: It could be that the problem is 2D array, I'll check this.

StefH commented 1 year ago

https://github.com/StefH/ProxyInterfaceSourceGenerator/pull/55

StefH commented 1 year ago

@FatSwords It's fixed. A new version will be released shortly.

FatSwords commented 1 year ago

Awesome - just got that running and it works a treat - thank you!