Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Upgrade to Aspire 9.1, new support to Codespaces#7

Merged
elbruno merged 5 commits intoAzure-Samples:mainfrom
elbruno:main
Feb 25, 2025
Merged

Upgrade to Aspire 9.1, new support to Codespaces#7
elbruno merged 5 commits intoAzure-Samples:mainfrom
elbruno:main

Conversation

@elbruno
Copy link
Contributor

@elbruno elbruno commented Feb 25, 2025

This pull request includes several changes to improve the .NET Aspire project, including updates to the development container configuration, enhancements to the product memory context, and improvements to the user interface for search functionality. The most important changes are listed below:

Development Container Configuration:

  • Updated the .devcontainer/devcontainer.json to use a pre-built image instead of building from a Dockerfile, added host requirements, and specified commands to run on container creation and start. [1] [2]

Product Memory Context Enhancements:

  • Refactored MemoryContext class to use constants, readonly fields, and added checks to prevent reinitialization. Improved logging and error handling in the InitMemoryContextAsync and Search methods. [1] [2] [3] [4]

User Interface Improvements:

  • Enhanced the loading state and error handling in the Search.razor component to provide better user feedback during search operations. [1] [2]

Documentation Updates:

  • Removed outdated notes and added instructions for reusing existing Azure resources in the README.md file. [1] [2] [3] [4]

Dependency Updates:

  • Updated package references in the Products.csproj file to use newer versions of dependencies, including Aspire.Azure.AI.OpenAI and Aspire.Microsoft.EntityFrameworkCore.SqlServer. [1] [2]

Significantly refactored `MemoryContext.cs` to improve initialization, error handling, and logging. Updated `Products.csproj` to remove unnecessary references and upgrade package versions. Enhanced `Program.cs` with additional logging for memory context initialization. Modified `launchSettings.json` to include new environment variables for local development. Updated `Store.csproj`, `eShopAppHost.csproj`, and `eShopServiceDefaults.csproj` to use newer versions of various packages for improved functionality and performance.
- Added a constructor to `SearchResponse` to initialize the `Products` list.
- Updated SQL database configuration in `Program.cs` to use a persistent lifetime for connections.
- Streamlined response handling in `ProductEndpoints` by removing unnecessary status code production.
- Added a using directive for `Microsoft.CodeAnalysis.FlowAnalysis.DataFlow` in `MemoryContext.cs`.
- Enhanced user experience in `Search.razor` with a loading spinner and improved error handling.
- Implemented robust error logging in `ProductService` for internal server errors and not found responses.
DETAILS

- Added instructions for reusing existing Azure resources.
- Included command to set user secrets for OpenAI connection strings.
- Clarified modifications needed in `program.cs` for Azure OpenAI client.
- Retained note on .NET Aspire support in GitHub Codespaces with version 9.1 improvements.
- Preserved telemetry section highlighting integration with Aspire Dashboard.
@elbruno elbruno requested a review from Copilot February 25, 2025 19:45
Copy link

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.

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

Comments suppressed due to low confidence (1)

src/Products/Endpoints/ProductEndpoints.cs:142

  • The removal of the 'Produces(StatusCodes.Status404NotFound)' declaration means that if a 404 response is returned, it will not be documented correctly. Please verify that the endpoint's response types now accurately reflect the intended API behavior.
.Produces<SearchResponse>(StatusCodes.Status200OK);

catch (Exception ex)
{
_logger.LogError(ex, "Error during Search.");
throw ex;
Copy link

Copilot AI Feb 25, 2025

Choose a reason for hiding this comment

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

Rethrowing the exception with 'throw ex;' resets the stack trace. Consider using 'throw;' to preserve the original stack trace.

Suggested change
throw ex;
throw;

Copilot uses AI. Check for mistakes.
@elbruno elbruno merged commit d80a853 into Azure-Samples:main Feb 25, 2025
1 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants