Skip to content

Webapi exception #916

@georgegao0

Description

@georgegao0

Describe the bug
The following exception is thrown after the web api is started and the first page is loading. Azure Ad authentication is enabled.

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at Microsoft.SemanticKernel.KernelExtensions.Build(IKernelBuilder builder)
at CopilotChat.WebApi.Services.SemanticKernelProvider.GetCompletionKernel() in C:\Repos\chat-copilot\webapi\Services\SemanticKernelProvider.cs:line 28
at CopilotChat.WebApi.Extensions.SemanticKernelExtensions.<>c.b__2_0(IServiceProvider sp) in C:\Repos\chat-copilot\webapi\Extensions\SemanticKernelExtensions.cs:line 55
at ResolveService(ILEmitResolverBuilderRuntimeContext, ServiceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at lambda_method110(Closure, Object, HttpContext, IServiceProvider)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

To Reproduce
Steps to reproduce the behavior:

  1. Start the web api project.
  2. Open browser and navigate to https://localhost:3000/.
  3. See error

Expected behavior
It doesn't happen all the time, just occasionally.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions