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

introduce IPC between ts part and C# part to report diagnostics and write logs #5917

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

ArcturusZhang
Copy link
Member

@ArcturusZhang ArcturusZhang commented Feb 10, 2025

Fixes #5920

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Feb 10, 2025
@azure-sdk
Copy link
Collaborator

azure-sdk commented Feb 10, 2025

API change check

APIView has identified API level changes in this PR and created following API reviews.

@typespec/http-client-csharp

This reverts commit 25cf9b5.
@ArcturusZhang ArcturusZhang changed the title Some attempts to introduce IPC between ts part and C# part to report diagnostics and write logs introduce IPC between ts part and C# part to report diagnostics and write logs Feb 18, 2025
@ArcturusZhang
Copy link
Member Author

@JoshLove-msft this should also contribute to this change despite it has merged: #5904
In general we should avoid to introduce such complicated logic in our emitter, and it would be more straight forward to figure this out in the generator

@ArcturusZhang ArcturusZhang marked this pull request as ready for review February 19, 2025 08:26
@@ -61,10 +61,6 @@ public static InputEnumType CreateEnumType(ref Utf8JsonReader reader, string? id
}

name = name ?? throw new JsonException("Enum must have name");
if (summary is null && doc is null)
{
Console.Error.WriteLine($"[Warn]: Enum '{name}' must have either a summary or doc");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we intend to not replace this?


public void Debug(string message)
{
SendNotification("trace", new
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use constant for "trace"

{
if (targetCrossLanguageDefinitionId != null)
{
SendNotification("diagnostic", new
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use const


private void Dispose(bool disposing)
{
if (!_disposedValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: _disposed

@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.TypeSpec.Generator.EmitterRpc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

@@ -30,9 +31,10 @@ public static async Task<int> Main(string[] args)

private static async Task<int> Run(CommandLineOptions options, GeneratorRunner runner)
{
var emitter = Emitter.Instance;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not use using?

Copy link
Contributor

@JoshLove-msft JoshLove-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we introduce a minimal E2E test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[http-client-csharp] The generator should report any error/warning/information back to the emitter
3 participants