Skip to content

Tweak ContentSafetyOptions.Enabled attribution and stream-line ServiceExtensiosn - #234

Merged
Chris (crickman) merged 1 commit into
mainfrom
fix-csopt
Aug 21, 2023
Merged

Tweak ContentSafetyOptions.Enabled attribution and stream-line ServiceExtensiosn#234
Chris (crickman) merged 1 commit into
mainfrom
fix-csopt

Conversation

@crickman

@crickman Chris (crickman) commented Aug 21, 2023

Copy link
Copy Markdown
Contributor

Motivation and Context

Unhandled exception. Microsoft.Extensions.Options.OptionsValidationException: DataAnnotation validation failed for 'ContentSafetyOptions' members: '' with the error: ''Enabled' must be a string.'.
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd[TArg](String name, Func`3 createOptions, TArg factoryArgument)
   at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
   at Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.<>c__DisplayClass0_1`1.<ValidateOnStart>b__1()
   at Microsoft.Extensions.DependencyInjection.ValidationHostedService.StartAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Microsoft.Extensions.DependencyInjection.ValidationHostedService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at CopilotChat.WebApi.Program.Main(String[] args) in C:\Users\crickman\source\repos\sk-chat-copilot\webapi\Program.cs:line 115
   at CopilotChat.WebApi.Program.<Main>(String[] args)

Description

  • I think the whitespace instruction confused the validation on the type.
  • Reducing repeated code / increase consistency in ServiceExtensions.cs

Contribution Checklist

@crickman Chris (crickman) added bug Something isn't working webapi Pull requests that update .net code labels Aug 21, 2023
@crickman Chris (crickman) self-assigned this Aug 21, 2023
@crickman
Chris (crickman) added this pull request to the merge queue Aug 21, 2023
Merged via the queue into main with commit ec746e8 Aug 21, 2023
@crickman
Chris (crickman) deleted the fix-csopt branch August 21, 2023 21:13
Team Leader (teamleader-dev) pushed a commit to vlink-group/chat-copilot that referenced this pull request Oct 7, 2024
…eExtensiosn (microsoft#234)

### Motivation and Context

```
Unhandled exception. Microsoft.Extensions.Options.OptionsValidationException: DataAnnotation validation failed for 'ContentSafetyOptions' members: '' with the error: ''Enabled' must be a string.'.
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd[TArg](String name, Func`3 createOptions, TArg factoryArgument)
   at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
   at Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.<>c__DisplayClass0_1`1.<ValidateOnStart>b__1()
   at Microsoft.Extensions.DependencyInjection.ValidationHostedService.StartAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Microsoft.Extensions.DependencyInjection.ValidationHostedService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at CopilotChat.WebApi.Program.Main(String[] args) in C:\Users\crickman\source\repos\sk-chat-copilot\webapi\Program.cs:line 115
   at CopilotChat.WebApi.Program.<Main>(String[] args)
```
<!-- Thank you for your contribution to the copilot-chat repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

- I think the whitespace instruction confused the validation on the
type.
- Reducing repeated code / increase consistency in
`ServiceExtensions.cs`
### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/copilot-chat/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/copilot-chat/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
Kyle Beachem (kb0039) pushed a commit to aaronba/chat-copilot that referenced this pull request Jan 8, 2025
…eExtensiosn (microsoft#234)

### Motivation and Context

```
Unhandled exception. Microsoft.Extensions.Options.OptionsValidationException: DataAnnotation validation failed for 'ContentSafetyOptions' members: '' with the error: ''Enabled' must be a string.'.
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd[TArg](String name, Func`3 createOptions, TArg factoryArgument)
   at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
   at Microsoft.Extensions.DependencyInjection.OptionsBuilderExtensions.<>c__DisplayClass0_1`1.<ValidateOnStart>b__1()
   at Microsoft.Extensions.DependencyInjection.ValidationHostedService.StartAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Microsoft.Extensions.DependencyInjection.ValidationHostedService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at CopilotChat.WebApi.Program.Main(String[] args) in C:\Users\crickman\source\repos\sk-chat-copilot\webapi\Program.cs:line 115
   at CopilotChat.WebApi.Program.<Main>(String[] args)
```
<!-- Thank you for your contribution to the copilot-chat repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

- I think the whitespace instruction confused the validation on the
type.
- Reducing repeated code / increase consistency in
`ServiceExtensions.cs`
### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/copilot-chat/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/copilot-chat/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
Jonny Toombs (jdtoombs) pushed a commit to jdtoombs/chat-copilot that referenced this pull request Apr 10, 2025
* feat: send conversations on reconnect

* style: lint
Jonny Toombs (jdtoombs) pushed a commit to jdtoombs/chat-copilot that referenced this pull request Apr 10, 2025
…3.1 in /integration-tests (microsoft#234)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working webapi Pull requests that update .net code

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants