.net-4.6

Best method to close a keep-alive FTP or FTPS connection in C# (.NET 4.6)?

流过昼夜 提交于 2019-12-13 12:13:43
问题 In C# (.NET 4.6) I am using a keep-alive FTPS connection to download a couple of files in a loop like this: foreach (string filename in filenames) { string requestUriString = GetFtpUriString(myDir) + "/" + filename; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(requestUriString); request.Method = WebRequestMethods.Ftp.DownloadFile; request.Credentials = new NetworkCredential(myFtpsUsername, myFtpsPassword); request.EnableSsl = true; request.ConnectionGroupName =

WebClient - DownloadFileAsync not working when called second time

雨燕双飞 提交于 2019-12-13 06:49:04
问题 I've build simple method that downloads single file. When I call that method first time everything works fine, but when called second time file isn't downloaded. Below is my code: public void DownloadFile(string fileUrl, string path) { using (var webClient = new WebClient()) { webClient.DownloadFileCompleted += (sender, e) => { if (e.Error == null & !e.Cancelled) { Debug.WriteLine(@"Download completed!"); } }; var url = new Uri(fileUrl); try { webClient.OpenRead(url); string

Get Symbol from CatchDeclaration

六眼飞鱼酱① 提交于 2019-12-13 01:05:57
问题 How do I get the symbol info of the instance in a CatchDeclaration? Basically I want to get the symbol so that I can compare it later to see that a method was called on that symbol. Basically I have this: catch (Exception ex) {} and I want the SymbolInfo for "ex". I get the catch declaration with: var catchDeclaration = catchClause.DescendantNodes().OfType<CatchDeclarationSyntax>().FirstOrDefault(); But I seem to only be able to get the SyntaxToken from the declaration ( catchDeclaration

Building/Bundling an Angular 2 application for a .NET MVC project

给你一囗甜甜゛ 提交于 2019-12-12 17:11:36
问题 I currently have an angular '2' application inside of a .NET 4.6 project. It is working nicely however I have question with regards to bundling. The application was created using the latest angular CLI and I have a preference to building/bundling the application with it. The bundle's webpack creates are fantastic from my experience. My question to you is do you have any recommendations/idea's with regards to bundling and thus consuming this bundle in a .NET MVC application? I have seen some

AutoFixture cannot create Claim (with .NET Framework 4.6)

拜拜、爱过 提交于 2019-12-12 11:32:43
问题 I've just installed VS2015, which at the same time installed .NET Framework 4.6, and suddenly AutoFixture 3.30.8 is unable to create a Claim object. I'm guessing having the new .NET Framework version 4.6 is causing some issue inside AutoFixture. I created a test project (targeting .NET Framework 4.5.1) containing the following code in VS2013: using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Ploeh.AutoFixture; namespace AutoFixtureTester { [TestClass] public class

Error 401 when accessing an API protected by IdentityServer3

六月ゝ 毕业季﹏ 提交于 2019-12-12 04:34:34
问题 I'm getting a 401 error when I try to access a resource from an API protected by IdentityServer3. I can log in and get the access_token quietly from the Host application of IdentityServer3, but I cannot use the access_token to consume this resource. I configured my Host of IdentityServer in Startup class like this: public void Configuration(IAppBuilder app) { Log.Logger = new LoggerConfiguration() .WriteTo.Trace() .CreateLogger(); AntiForgeryConfig.UniqueClaimTypeIdentifier = Constants

ReflectionTypeLoadException in ASP.NET Core MVC application

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 15:37:28
问题 I'm running into a problem running an ASP.NET Core 1.0 application targeting .NET Framework 4.6. The problem didn't occur until we tried to run the application on a server running Windows Server 2016. The app is hosted in IIS and I have the .NET Core 1.0 Windows Hosting Bundle installed on the server. Upon loading the site a 500 error is returned and this is written to the Logs: An unhandled exception has occurred: Unable to load one or more of the requested types. Retrieve the

.NET 4.6 Oracle.ManagedDataAccess Requirements

◇◆丶佛笑我妖孽 提交于 2019-12-10 23:58:16
问题 What exactly is the minimum requirement to get a .NET 4.6 application working with Oracle? We are already using the Oracle.ManagedDataAccess client. We are using the Entity Framework and also DataSets (TableAdapters,...) for data access. Currently we always install the "full" Oracle Administrator client for our applications which has about 1,2 GB, but what is really necessary to make our application(s) working with Oracle? The Nuget page of the Oracle.ManagedDataAccess driver says "No

What is the point of .NET 4.6's Task.CompletedTask?

偶尔善良 提交于 2019-12-10 12:38:20
问题 This blog post mentions the new Task APIs, including a new Task.CompletedTask property introduced in .NET 4.6. Why was this added? How is this better than, say, Task.FromResult(whatever) ? 回答1: Task.FromResult(whatever) works for Task<TResult> , but until 4.6 there was nothing for the nongeneric task. You could use FromResult with a dummy value and implicitly cast it to Task , but that somewhat obfuscates the intent (you're not really returning any asynchronous value ) and allocates objects

Why Does .NET 4.6 Specific Code Compile When Targeting Older Versions of the Framework? [duplicate]

廉价感情. 提交于 2019-12-08 16:13:29
问题 This question already has answers here : Does C# 6.0 work for .NET 4.0? (5 answers) Closed 4 years ago . I have a project that targets older versions of the .NET framework (.NET 4.5.2). I installed Visual Studio 2015 (and therefore .NET 4.6 on my machine). I noticed that if I use C# language features released in .NET 4.6/C# 6, it still compiles. If my project's target framework is < .NET 4.6, shouldn't this not compile: public string MyExpressionBodyProperty => "1"; //auto properties are new