.net-4.7

Finding out where unobservedTaskException is thrown: stacktrace is null

那年仲夏 提交于 2021-01-01 08:00:05
问题 I have a large C# appication using third party libraries and somewhere in the application a task is run which is not awaited and throws an exception. So I added an event handler to TaskScheduler.UnobservedTaskException: TaskScheduler.UnobservedTaskException += (sender, args) => { _logger.Error(args.Exception); args.SetObserved(); }; However, when this handler is executed, I get some exception with a stacktrace of null: System.AggregateException: A Task's exception(s) were not observed either

Finding out where unobservedTaskException is thrown: stacktrace is null

你。 提交于 2021-01-01 07:59:04
问题 I have a large C# appication using third party libraries and somewhere in the application a task is run which is not awaited and throws an exception. So I added an event handler to TaskScheduler.UnobservedTaskException: TaskScheduler.UnobservedTaskException += (sender, args) => { _logger.Error(args.Exception); args.SetObserved(); }; However, when this handler is executed, I get some exception with a stacktrace of null: System.AggregateException: A Task's exception(s) were not observed either

KB4344167 security update breaks TLS Code

ぐ巨炮叔叔 提交于 2019-12-19 18:58:15
问题 Hopefully someone can help with this problem. Recently our machines were updated with KB4344167 which includes security updates for .NET 4.7.1. Unfortunately this update has broken our code for a Webrequest . When we run the code below we get this error: The request was aborted: Could not create SSL/TLS secure channel. // Create a request for the URL. WebRequest request = WebRequest.Create(url); //specify to use TLS 1.2 as default connection ServicePointManager.SecurityProtocol =

Call async method on UI thread

对着背影说爱祢 提交于 2019-12-17 19:52:45
问题 I'm trying to create WPF client with IdentityServer authentication. I'm using their OidcClient to get logged in. It's whole async while my app is sync and can't be refactored without huge effort. Calling var result = await _oidcClient.LoginAsync(); doesn't wait for the result. Calling Wait() or .Result causes deadlock. Wrapping it to other Task.Run is complaining that the method is not running on UI thread (it opens browser with login dialog). Do you have any idea, how to solve this? Do I

Is it good practice to position UIElements via RenderTransform

落花浮王杯 提交于 2019-12-12 04:32:52
问题 In my WPF application I have a control that acts like a zoom box. You can zoom and drag its content. In my case this content is a grid that contains an image and some UserControls. These UserControls have to be positioned ontop of the image to highlight some segments of that image. Here is an example (this is not an actual use case): My question is, how should I position those red rectangles (what is the better practise here)? By replacing the grid with a canvas and use Canvas.SetLeft resp.

WPF touch application (partially) freezes on .NET Framework 4.7

感情迁移 提交于 2019-12-04 21:57:07
问题 Update Microsoft acknowledged the issue: Gepost door Microsoft op 13/10/2017 om 11:38 Thank you for reporting this. We are aware of this issue and are fixing it in a future version of .NET. There is also a related issue that is being released in a servicing fix that will drastically reduce the possibility of hitting this problem. This will be serviced relatively soon. Problem Our WPF application is being used on tablets using touch (no stylus) and we are experiencing issues after the

What does “replaces versions” means in .NET Framework terms?

寵の児 提交于 2019-12-02 00:57:15
问题 Wikipedia says that the .NET Framework 4.7 replaces versions 4.0–4.6.2. Does this mean that I can run a program that requires (for example) .NET Framework 4.0 with only .NET Framework 4.7 installed? 回答1: That means that 4.7 is a drop in replacement for 4.0–4.6.2. For example, if you installed .net 2.0 on a system that already had .net 1.0 you would end up with two instances of .net: 1.0 & 2.0. If you install .net 4.7 on a system that has .net 4.6 only, then you would only have one .net

KB4344167 security update breaks TLS Code

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 17:23:33
Hopefully someone can help with this problem. Recently our machines were updated with KB4344167 which includes security updates for .NET 4.7.1. Unfortunately this update has broken our code for a Webrequest . When we run the code below we get this error: The request was aborted: Could not create SSL/TLS secure channel. // Create a request for the URL. WebRequest request = WebRequest.Create(url); //specify to use TLS 1.2 as default connection ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; request.Timeout = int.Parse

Error using long paths in .net 4.7

不想你离开。 提交于 2019-12-01 03:28:34
I have set Enable Win32 Long Paths in the Local Group Policy Editor to Enabled and restarted the computer. And here's the code: string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); for (int i = 0; i < 10; i++) path += "\\" + new string('z', 200); Directory.CreateDirectory(path); I'm getting the error: System.IO.DirectoryNotFoundException: 'Could not find a part of the path 'C:\Users...\Desktop\zzzzzzzzzz... (Which is actually a strange error message.) app.config already has: <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7" /> More info (probably not

Error using long paths in .net 4.7

此生再无相见时 提交于 2019-11-30 22:48:21
问题 I have set Enable Win32 Long Paths in the Local Group Policy Editor to Enabled and restarted the computer. And here's the code: string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); for (int i = 0; i < 10; i++) path += "\\" + new string('z', 200); Directory.CreateDirectory(path); I'm getting the error: System.IO.DirectoryNotFoundException: 'Could not find a part of the path 'C:\Users...\Desktop\zzzzzzzzzz... (Which is actually a strange error message.) app.config already