Commit fc4f7eb
committed
Fixed "System.InvalidOperationException" being thrown with message: "Cross-thread operation not valid: Control 'myRichTextBox' accessed from a thread other than the thread it was created on.".
This would occur when a log messages was emitted from a non-UI-thread during Form construction, before the window handle was created.
In these situations it is not sufficient to only check the richTextBox.InvokeRequired property as this would always return false - no matter what thread its on.1 parent a7c24e6 commit fc4f7eb
File tree
2 files changed
+20
-2
lines changed- Serilog.Sinks.RichTextBox.WinForms.Colored/Sinks/RichTextBoxForms
- Extensions
2 files changed
+20
-2
lines changedLines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
| 58 | + | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
59 | 77 | | |
60 | 78 | | |
61 | 79 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
0 commit comments