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

dotnet EOL warning suppression #70

Closed
wants to merge 4 commits into from

Conversation

CharlieSaunders
Copy link

Adding a property to the dotnet run process that will suppress EOL Framework warnings based on the bool from the config.

When using the package on older frameworks, the dotnet run process; rightly, displays that the framework being used has reached EOL. This however means that the JSON generated is invalid as it contains warnings IE:

C:\dotnet\sdk\7.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\path\to\the\node_modules\csharp-models-to-typescript\lib\csharp-models-to-json\csharp-models-to-json.csproj]
[{foo:bar}]

Which when ran through JSON.parse; index.js: 70, errors with "Unexpected token C in JSON at position 0".

Adding this additional parameter on the config; suppressEolFrameworkErrors, suppresses those EOL warnings and only the generated JSON is sent for parsing.

Adding a property to the dotnet run process that will suppress EOL Framework warnings based on the bool from the config.
Copy link
Collaborator

@digocesar digocesar left a comment

Choose a reason for hiding this comment

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

Please rebase this branch to the current master that has automated tests.

index.js Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@digocesar
Copy link
Collaborator

@svenheden and/or @SafeerH.
If dotnet process has this option to ignore EOL error, is not better to always pass this parameter to do not emmit the EOL error?
We had updated main to .Net 8.0, but this parameter can avoid the component stops working in the future, as happened recently.

@svenheden
Copy link
Owner

If dotnet process has this option to ignore EOL error, is not better to always pass this parameter to do not emmit the EOL error?

Yes that sounds like a good idea. I can't think of a scenario where you'd want to show that EOL error causing the JSON to be corrupted.

amended variable name and format for if check
amended variable name
@SafeerH
Copy link
Collaborator

SafeerH commented May 23, 2024

The root cause for the problem is the way of extracting the JSON from the console output.
If there's anything else apart from the JSON string in the Console output (stdout), the program breaks. Also relates to #61
So, I think we need to find a broader solution that will isolate the JSON irrespective of other console outputs.
I'm thinking of printing the JSON between markers, that will help us isolate the JSON.
I will try this approach and let you guys know. Thanks!

UPDATE:
Created a PR #78 with the solution. I hope this will resolve #61, #70 and similar issues.

@digocesar
Copy link
Collaborator

Hi @CharlieSaunders. Thanks for your help.
This PR is not needed anymore as the #78 solved the problem.

@digocesar digocesar closed this May 24, 2024
SafeerH added a commit to SafeerH/csharp-models-to-typescript that referenced this pull request Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants