-
Notifications
You must be signed in to change notification settings - Fork 11
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
Conversation
- Enhanced logging in `SemanticsHelpers` class to include filename and line position for type access issues.
There was a problem hiding this 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.`);
catch | ||
{ | ||
Log.Logger.Warning($"Multiple types found for '{typeAccess?.ToString()}' in the semantic tree. You may need to fully qualify the declaration."); | ||
|
||
// swallow |
There was a problem hiding this comment.
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.
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.
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.
…xsharp into missing-types-in-smodel
There was a problem hiding this 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.");
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:
src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Helpers/SemanticsHelpers.cs
: Enhanced error logging inFindTypeDeclaration
method to include file name, line, and character position when a type is not found or multiple types are found. Also added a try-catch block to handle potential exceptions gracefully. [1] [2]Configuration updates:
src/AXSharp.compiler/src/ixc/Properties/launchSettings.json
: Added--skip-deps
argument to thecommandLineArgs
for theixc-template-ref
configuration to align with theixc-simple-template
configuration.