Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid code generation for C# static proxy #19137

Closed
1 task done
Shtong opened this issue Feb 26, 2024 · 1 comment
Closed
1 task done

Invalid code generation for C# static proxy #19137

Shtong opened this issue Feb 26, 2024 · 1 comment

Comments

@Shtong
Copy link
Contributor

Shtong commented Feb 26, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Description

The C# code that is generated by the generate-proxy command is sometimes invalid (does not build) when DTOs contain certain combination of generic arguments.

Reproduction Steps

Tested using ABP CLI 8.0.4:

  1. Create a new project using the default settings abp new Abp.ReproProxyGen. Run the Db Migrator to initialize the database.
  2. Create the following DTO in the Application.Contracts project:
public class TestOutputDto
{
    public IDictionary<string, IDictionary<string, IEnumerable<string>>> Values { get; set; }
}
  1. Create an app service in the Application project, with a method that returns the DTO we just created
public class TestAppService : ReproProxyGenAppService
{
    public TestOutputDto GetRepro()
    {
        return null;
    }
}
  1. Build and run the application
  2. Run the proxy generation command. For example: abp generate-proxy -t csharp -u https://localhost:44385 -wd .\src\Abp.ReproProxyGen.HttpApi.Client\

Expected behavior

The proxy generation command creates new files in the HttpApi.Client project. After these files are generated, the project can still build.

Actual behavior

The proxy generation command did create the expected files. However, the file containing the DTO has a syntax error that prevents the project from building:

public class TestOutputDto
{
    public Dictionary<string, IDictionary<String, IEnumerableString>>> Values { get; set; }
    // Missing '<' character here:       --------------------^
}

Regression?

Not that know of

Known Workarounds

Override the C# generation service to provide your own working implementation

Version

8.0.4

User Interface

Common (Default)

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

@realLiangshiwei
Copy link
Member

We will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants