Commit fadeac6
committed
[Xamarin.Android.Build.Tasks] Catch Exception when setting Console.InputEncoding
Context https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1130414
For some unknown reason the setting of `Console.InputEncoding`
on a customers machine is throwing an IOException. This then
causes Visual Studio to completely crash.
```
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.IOException
at System.IO.__Error.WinIOError(Int32, System.String)
at System.IO.__Error.WinIOError()
at System.Console.set_InputEncoding(System.Text.Encoding)
at Xamarin.Android.Tasks.Aapt2Daemon.Aapt2DaemonStart()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
```
At this time we are still unsure as to what is causing the problem.
But we should at least catch the exception to that Visual Studio does
not crash.
We need to figure out a way of reporting this issue somehow in the
exception handler so we can get more data.
Note: Not sure what is going on with the line ending changes :/
For reference the reason we have to use `Console.InputEncoding` is
because of [this](https://referencesource.microsoft.com/#System/services/monitoring/system/diagnosticts/Process.cs,2154).
The `System.Diagnostic.Process` uses the `Console.InputEncoding` when
creating the `StreamWriter` for `StandardInput`.1 parent a134aa7 commit fadeac6
1 file changed
+48
-18
lines changedLines changed: 48 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
147 | 176 | | |
148 | 177 | | |
149 | 178 | | |
| |||
158 | 187 | | |
159 | 188 | | |
160 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
161 | 193 | | |
162 | 194 | | |
163 | | - | |
| 195 | + | |
164 | 196 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | 197 | | |
169 | | - | |
170 | | - | |
| 198 | + | |
| 199 | + | |
171 | 200 | | |
172 | | - | |
| 201 | + | |
| 202 | + | |
173 | 203 | | |
174 | 204 | | |
175 | 205 | | |
176 | 206 | | |
177 | | - | |
| 207 | + | |
178 | 208 | | |
179 | 209 | | |
180 | 210 | | |
| |||
183 | 213 | | |
184 | 214 | | |
185 | 215 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
190 | 222 | | |
191 | | - | |
192 | | - | |
193 | 223 | | |
194 | | - | |
| 224 | + | |
195 | 225 | | |
196 | 226 | | |
197 | 227 | | |
| |||
201 | 231 | | |
202 | 232 | | |
203 | 233 | | |
204 | | - | |
205 | | - | |
| 234 | + | |
| 235 | + | |
206 | 236 | | |
207 | 237 | | |
208 | 238 | | |
| |||
256 | 286 | | |
257 | 287 | | |
258 | 288 | | |
259 | | - | |
| 289 | + | |
0 commit comments