[PR #1104] [MERGED] Use try..catch to set encoding in WireMockConsoleLogger #1230

Closed
opened 2025-12-29 09:18:58 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/wiremock/WireMock.Net/pull/1104
Author: @asherber
Created: 5/17/2024
Status: Merged
Merged: 5/17/2024
Merged by: @StefH

Base: masterHead: console-encoding


📝 Commits (1)

  • eccff02 Use try..catch to set encoding in WireMockConsoleLogger

📊 Changes

1 file changed (+5 additions, -1 deletions)

View changed files

📝 src/WireMock.Net/Logging/WireMockConsoleLogger.cs (+5 -1)

📄 Description

In Linqpad, the "console" is just a facade over web browser output, so calling Console.OutputEncoding = System.Text.Encoding.UTF8 in the constructor for WireMockConsoleLogger throws an exception.

This PR adds a try..catch block to that code, so that the logger can be used in Linqpad (and any other non-standard consoles).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/wiremock/WireMock.Net/pull/1104 **Author:** [@asherber](https://github.com/asherber) **Created:** 5/17/2024 **Status:** ✅ Merged **Merged:** 5/17/2024 **Merged by:** [@StefH](https://github.com/StefH) **Base:** `master` ← **Head:** `console-encoding` --- ### 📝 Commits (1) - [`eccff02`](https://github.com/wiremock/WireMock.Net/commit/eccff02135cc27f101f74d1130b60d639d749c9d) Use try..catch to set encoding in WireMockConsoleLogger ### 📊 Changes **1 file changed** (+5 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/WireMock.Net/Logging/WireMockConsoleLogger.cs` (+5 -1) </details> ### 📄 Description In Linqpad, the "console" is [just a facade](https://forum.linqpad.net/discussion/451/some-of-console-properties-are-not-working) over web browser output, so calling `Console.OutputEncoding = System.Text.Encoding.UTF8` in the constructor for `WireMockConsoleLogger` throws an exception. This PR adds a `try..catch` block to that code, so that the logger can be used in Linqpad (and any other non-standard consoles). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 09:18:58 +01:00
adam closed this issue 2025-12-29 09:18:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net#1230