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

Enhance logging and update launch settings #392

Merged
merged 4 commits into from
Mar 27, 2025
Merged

Conversation

PTKu
Copy link
Contributor

@PTKu PTKu commented Mar 27, 2025

Enhanced logging in SemanticsHelpers class to include filename and line position for type access issues.

This pull request includes several changes to the AXSharp.Cs.Compiler project, focusing on improving error logging and updating configuration settings.

Enhancements to error logging:

Configuration updates:

- Enhanced logging in `SemanticsHelpers` class to include filename and line position for type access issues.
@PTKu PTKu requested a review from Copilot March 27, 2025 09:02
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances error logging capabilities in the SemanticsHelpers class and updates the launch settings configuration.

  • Enhanced logging in the FindTypeDeclaration method to include file name, line, and character position.
  • Introduced a try-catch block to gracefully handle exceptions during logging.
  • Updated launch settings by adding a --skip-deps argument to the ixc-template-ref configuration.

Reviewed Changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs Updated error logging and added exception handling in the FindTypeDeclaration method
src/ixc/Properties/launchSettings.json Added a --skip-deps command line argument to align configuration settings
Files not reviewed (1)
  • src/AXSharp.compiler/src/ixc/Properties/launchSettings.json: Language not supported
Comments suppressed due to low confidence (2)

src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs:87

  • [nitpick] Consider breaking the long warning message into shorter, well-punctuated phrases to improve readability and clarity.
Log.Logger.Warning(`${span?.Filename}(${line}:${character}) : Type '${typeAccess.TypeSymbol.Name}' not found the type may not be eligible for transpile or meta information is not available because this type is not defined in AX# compliant project. `);

src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs:92

  • [nitpick] Consider adding punctuation and clearer separation in the error message to enhance its readability.
Log.Logger.Warning(`${span?.Filename}(${line}:${character}) : Multiple types found for '${typeAccess.TypeSymbol.Name}' the declaration appears ambiguous. You may need to fully qualify the declaration.`);

Comment on lines 95 to 98
catch
{
Log.Logger.Warning($"Multiple types found for '{typeAccess?.ToString()}' in the semantic tree. You may need to fully qualify the declaration.");

// swallow
Copy link
Preview

Copilot AI Mar 27, 2025

Choose a reason for hiding this comment

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

Consider logging the exception details within the catch block rather than silently swallowing it to aid in debugging.

Suggested change
catch
{
Log.Logger.Warning($"Multiple types found for '{typeAccess?.ToString()}' in the semantic tree. You may need to fully qualify the declaration.");
// swallow
catch (Exception ex)
{
Log.Logger.Error(ex, "An error occurred while finding type declaration.");

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

PTKu added 2 commits March 27, 2025 10:05
Updated the catch block in the SemanticsHelpers class to log a warning message using Log.Logger.Warning when an exception is caught. This change enhances visibility into potential issues by providing a warning message that indicates the system failed to determine the location of the type declaration for the specified typeAccess?.TypeSymbol?.Name.
@PTKu PTKu requested a review from Copilot March 27, 2025 09:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances logging in the SemanticsHelpers class by including file name and line position details in error messages for type access issues, and updates launch settings for configuration consistency.

  • Enhanced error logging in SemanticsHelpers.cs with detailed location data and a try-catch block.
  • Updated launchSettings.json to include the --skip-deps argument for the ixc-template-ref configuration.

Reviewed Changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs Added detailed logging with file and line info and a try-catch block.
src/AXSharp.compiler/src/ixc/Properties/launchSettings.json Updated commandLineArgs for ixc-template-ref configuration to include --skip-deps.
Files not reviewed (1)
  • src/AXSharp.compiler/src/ixc/Properties/launchSettings.json: Language not supported
Comments suppressed due to low confidence (3)

src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs:82

  • Consider verifying that 'span' is not null before accessing 'span.Value' to avoid triggering exceptions that are then handled by the catch block.
var span = typeAccess?.Location?.GetLineSpan();

src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs:87

  • [nitpick] Consider rephrasing this warning message for clarity; for example: "{filename}({line}:{character}): Type '{typeName}' not found; the type may be ineligible for transpilation or may lack sufficient meta information."
Log.Logger.Warning("${span?.Filename}(${line}:${character}) : Type '${typeAccess.TypeSymbol.Name}' not found the type may not be eligible for transpile or meta information is not available because this type is not defined in AX# compliant project. ");

src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs:92

  • [nitpick] Consider clarifying the warning message about multiple types; a revised message could be: "{filename}({line}:{character}): Multiple declarations for type '{typeName}' were found; consider fully qualifying the type declaration."
Log.Logger.Warning("${span?.Filename}(${line}:${character}) : Multiple types found for '${typeAccess.TypeSymbol.Name}' the declaration appears ambiguous. You may need to fully qualify the declaration.");

@PTKu PTKu marked this pull request as ready for review March 27, 2025 09:19
@PTKu PTKu merged commit e58a40b into dev Mar 27, 2025
2 checks passed
@PTKu PTKu deleted the missing-types-in-smodel branch March 27, 2025 09:19
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.

1 participant