Questions tagged [.net-4.5]

Version 4.5 of the Microsoft .NET Framework. Use for questions specifically related to .NET Framework 4.5. For questions on .NET Framework generally, use the .net tag.

.net-4.5
Filter by
Sorted by
Tagged with
30 votes
3 answers
34k views

Visual Studio "Target framework" missing

I am trying to compile my .NET Standard class library project with .NET Framework 4.5.2. However, as you can see in my screenshot, version 4.5.2 is not shown in the offered list of target frameworks: ...
famle's user avatar
  • 491
30 votes
3 answers
21k views

.NET 4.5 Bug in UserPrincipal.FindByIdentity (System.DirectoryServices.AccountManagement)

In testing our .NET 4.0 application under .NET 4.5, we've encountered a problem with the FindByIdentity method for UserPrincipal. The following code works when run in a .NET 4.0 runtime, but fails ...
Grand Avenue Software's user avatar
29 votes
4 answers
31k views

How to register .Net 4.5.1 with IIS8 on windows 10

How to register .Net 4.5.1 with IIS8 on windows 10 machine? it used to be simple as running command "aspnet_regiis -i"...but not anymore. if try to run this command i get error This option is not ...
LP13's user avatar
  • 32.3k
29 votes
3 answers
18k views

.Net 4.5 WebSocket Server Running on Windows 7?

I know the ClientWebSocket class of .Net 4.5 is not supported on Windows 7, but is it possible to create a WebSocket server running on Windows 7 using the .Net 4.5 API? To make myself clearer, ...
sternr's user avatar
  • 6,356
29 votes
2 answers
26k views

Broadcasting message to all clients except self in SignalR

I realize that these questions are similar: SignalR - Broadcast to all clients except Caller Send a message to all clients in a Group, except for the current client However, they are old and ...
Icarus's user avatar
  • 63.6k
28 votes
5 answers
69k views

HttpClient authentication header not getting sent

I'm trying to use an HttpClient for a third-party service that requires basic HTTP authentication. I am using the AuthenticationHeaderValue. Here is what I've come up with so far: HttpRequestMessage&...
Ross's user avatar
  • 2,458
28 votes
2 answers
22k views

awaiting on an observable

So in the sad days of C# 4.0, I created the following "WorkflowExecutor" class that allowed asynchronous workflows in the GUI thread by hacking into IEnumerable's "yield return" continuations to wait ...
Dax Fohl's user avatar
  • 10.7k
28 votes
6 answers
31k views

Format A TimeSpan With Years

I have a class with 2 date properties: FirstDay and LastDay. LastDay is nullable. I would like to generate a string in the format of "x year(s) y day(s)". If the total years are less than 1, I ...
Dan's user avatar
  • 9,747
28 votes
4 answers
17k views

c# .net 4.5 async / multithread?

I'm writing a C# console application that scrapes data from web pages. This application will go to about 8000 web pages and scrape data(same format of data on each page). I have it working right now ...
Kyle's user avatar
  • 33.2k
28 votes
1 answer
26k views

Passing a task as parameter

I am not sure whether this is possible, so here me out: I have a sequence of action to perform multiple async Task MethodA(...) { // some code // a call to specific Async IO bound method ...
Goran's user avatar
  • 6,398
28 votes
4 answers
5k views

Prevent scrolling when mouse enters WPF ComboBox dropdown

When a ComboBox has a large number of items, its dropdown will become scrollable. When the user invokes this dropdown, and moves the mouse cursor to enter the bounds of the dropdown from the bottom, ...
JoeGaggler's user avatar
  • 1,226
28 votes
2 answers
29k views

Unit Of Work & Generic Repository with Entity Framework 5

I'm using ASP.NET MVC 4 with Entity Framework 5. I have model classes and Entity Maps to map existing tables to those model classes. All this is setup fine and works great. Now I want to mock this. I ...
Gaui's user avatar
  • 8,793
27 votes
4 answers
25k views

HTTP Error 403.14 - Forbidden - MVC4 .net 4.5 bundles

I made a MVC4 application with .net 4.5 using razor engine. It works fine when run locally with visual studio. When I deploy to IIS on windows server 2008 R2(all windows updates done), it appears my ...
Kyle's user avatar
  • 33.2k
27 votes
2 answers
5k views

Does .Net 4.5 support XML 1.1 yet (for characters invalid in XML 1.0)?

This is in the context of Web Services (client end). I need to interface with a back-end system (Java) and it is a requirement to transmit some control characters in the  and  range. ...
RichardTheKiwi's user avatar
27 votes
2 answers
17k views

How to profile WPF 4.5 UI performance?

I'm developing a .NET 4.5 WPF app and having UI rendering performance issues. After some googling, I came across WPF Performance Suite page which describes exactly the tool I need - Visual Profiler. ...
Alexander Abakumov's user avatar
27 votes
2 answers
6k views

Task.WhenAny and Unobserved Exceptions

Let's say I have three tasks, a, b, and c. All three are guaranteed to throw an exception at a random time between 1 and 5 seconds. I then write the following code: await Task.WhenAny(a, b, c); This ...
David Pfeffer's user avatar
26 votes
2 answers
71k views

Not allowed to load assembly from network location

I've recently set up a new Windows Server 2012 R2 environment and installed Visual Studio 2012. Now I'm having a problem with multiple .NET 4.5 project's I migrated from my old server, a Windows ...
Stijn's user avatar
  • 2,030
26 votes
1 answer
12k views

Is the CallerMemberName attribute in 4.5 "able to be faked"?

So .NET 4.5 introduces the CallerMemberNameAttribute, which seems like a godsend to anyone working with WPF and implementing INotifyPropertyChanged - my question is this: Is the attribute ...
JerKimball's user avatar
  • 16.7k
26 votes
7 answers
9k views

VS2012 $(exists) only accepts scalar values

Okay, this is more of a build error than a programming error. I have never had much reason to get my hands dirty with builds, so this error is baffling me. I have tried googling this error with ...
Madeline's user avatar
  • 645
26 votes
6 answers
5k views

Behaviour of List<T>.Sort in .NET 4.5 changed from .NET 4.0?

I have the following test inside a project targeting .NET 4.0: [TestFixture] public class Donkey { [Test] public void TestListSorting() { var expected = new[] {...
jonnystoten's user avatar
  • 7,075
26 votes
5 answers
85k views

Json does not exist in the namespace System

In this tutorial: http://www.asp.net/web-api/videos/getting-started/custom-validation Jon uses dynamic error = new JsonObject(); with using System.Json; I guess it's the JsonObject here: http://...
Cotten's user avatar
  • 8,937
26 votes
6 answers
11k views

c# Resharper 'No Tests Found in Project' / 'Inconclusive: Test wasn't run'

I've got ReSharper v8.2.1 installed. I have a VS2013 solution that contains several test projects. Most of them work just fine. However, one project is giving me trouble. In the Solution Explorer, I ...
djs's user avatar
  • 1,680
26 votes
1 answer
21k views

Web.config with XDT transform to do partial replace

I am in a situation where I just want to update a part of a the URL of a WCF endpoint. Right now we do this by including different configs with all the endpoints per 'variety'. This is tedious to ...
ranieuwe's user avatar
  • 2,278
26 votes
1 answer
4k views

Can you override the automatically captured value of a parameter attributed with CallerMemberName by explicitly passing a value?

I have a situation where in some context I want to pass an explicit value to my method with a parameter marked up with CallerMemberName, and from other contexts I want it to automatically capture. I ...
Jacques Bosch's user avatar
26 votes
7 answers
11k views

ETW, .NET 4.5 - how to write to the event log?

I am trying to wrap my head around ETW and how to integrate t into a high Performance application. We all know the old dreaded EventLog with it's non structured (and thus not so optimal) API. Now ...
TomTom's user avatar
  • 1
26 votes
2 answers
19k views

Will I have any issues if I upgrade from .NET 4.0 to 4.5 [closed]

I have an existing web app using a combination of MVC and WebForms on .NET 4.0. I want to upgrade to 4.5 to take advantage of some new features in EF 5 (which require 4.5). A couple of questions to ...
just.another.programmer's user avatar
25 votes
2 answers
17k views

How to keep .Net 4.0 behavior if .Net 4.5 is installed?

We have a Windows Form application that targets .Net Framework 4.0. After installing .Net Framework 4.5, the application starts crashing. We'll have to investigate the crashes and we'll most probably ...
Sylvain's user avatar
  • 19.2k
25 votes
3 answers
15k views

async/await and opening a FileStream?

I came across the following question when trying to determine if I was using the Stream methods such as ReadAsync and CopyToAsync correctly: C# 4.5 file read performance sync vs async In this ...
Alex Hope O'Connor's user avatar
25 votes
2 answers
33k views

How can I await an async method without an async modifier in this parent method?

I have a method that I want to await but I don't want to cause a domino effect thinking anything can call this calling method and await it. For example, I have this method: public bool Save(string ...
Neal's user avatar
  • 9,539
25 votes
6 answers
6k views

Gen2 collection not always collecting dead objects?

By monitoring the CLR #Bytes in all Heaps performance counter of a brand new .NET 4.5 server application over the last few days, I can notice a pattern that makes me think that Gen2 collection is not ...
darkey's user avatar
  • 3,722
25 votes
1 answer
3k views

Enum as Key in entity framework 5 throwing error on many to many joins

OK, this is a bit lengthy / obscure, but I'm getting an odd error in specific situation where I use an Enum as a table Key and attempt to query against the table while including more than one many-to-...
Gene Reddick's user avatar
  • 4,655
24 votes
3 answers
40k views

Cannot find `ZipArchive` in the “System.IO.Compression” namespace

My question is related to I didn't find "ZipFile" class in the "System.IO.Compression" namespace But I have referenced the DLL's for my 4.5.1 webforms project: Properties of ...
JP Hellemons's user avatar
  • 6,015
24 votes
1 answer
36k views

How can you get a .NET 4.5 website to run on IIS6?

I've got an old Windows 2003 server running IIS 6, and I chose .net 4.5 for my latest web app. Problem is I can't get it to run on the server... .NET 4.0 framework is installed. I've run ...
CodeRedick's user avatar
  • 7,376
24 votes
2 answers
7k views

HttpContext.Current.Items after an Async operation

Consider the following ASP.NET Web API Delegating Handler: public class MyHandler : DelegatingHandler { protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage ...
Gavin Osborn's user avatar
  • 2,593
24 votes
3 answers
26k views

Task status changes to RanToCompletion if the Task await's something

The question describes the same problem found here - MSDN Developer Forum. The question does not have an accepted answer, neither any of the answers given can be applied to my case (hence a different ...
tomsseisums's user avatar
  • 13.3k
24 votes
1 answer
6k views

what is the main difference between .net Async and google go light weight thread

When calling runtime.GOMAXPROCS(1) in go the runtime will only use one thread for all your goroutines. When doing io your goroutines will yield and let the other goroutines run on the same thread. ...
skyde's user avatar
  • 2,876
24 votes
4 answers
1k views

Changes to Math.Exp or double implementation in .net 4.5.2

If I run the statement Math.Exp(113.62826122038274).ToString("R") on a machine with .net 4.5.1 installed, then I get the answer 2.2290860617259248E+49 However, if I run the same command on a ...
Fergus Bown's user avatar
  • 1,686
23 votes
3 answers
1k views

When to use the "await" keyword

I'm writing a web page, and it calls some web services. The calls looked like this: var Data1 = await WebService1.Call(); var Data2 = await WebService2.Call(); var Data3 = await WebService3.Call(); ...
Eric B's user avatar
  • 4,417
23 votes
1 answer
18k views

WPF Radial Progressbar/Meter (i.e. Battery Meter) [closed]

I'm working on an Unified fitness app for Windows 8.1 and Windows Phone 8.1. Ideally one of the core views would feature a daily progress meter. The problem is that I haven't been able to come up with ...
TheMoonbeam's user avatar
23 votes
6 answers
15k views

Getting System.Net.Mail.MailMessage as a MemoryStream in .NET 4.5 beta

So, the below code used to work in .NET 4 to get a System.Net.Mail.MailMessage object as a MemoryStream, however with the release of .NET 4.5 beta a runtime exception occurs. Assembly assembly = ...
dimoss's user avatar
  • 1,506
23 votes
3 answers
40k views

Check .NET Framework 4.5 is installed or not Using Installshield 2010

I'm using InstallShield 2010. I want to check whether .NET framework 4.5 is installed or not on the machine. I can check .NET framework 4.0 is installed or not from registry, but I'm unable to find ...
Harish Reddy's user avatar
23 votes
8 answers
30k views

TcpListener: how to stop listening while awaiting AcceptTcpClientAsync()?

I don't know how to properly close a TcpListener while an async method await for incoming connections. I found this code on SO, here the code : public class Server { private TcpListener _Server; ...
Bastiflew's user avatar
  • 1,146
23 votes
2 answers
26k views

authentication and authorizing in ASP.NET MVC 5

Asp.net MVC 5 seems to have left behind using the AuthorizeAttribute class where you could create a custom authorize attribute by implementing the AuthorizeAttribute class, override its methods and ...
user20358's user avatar
  • 14.5k
23 votes
7 answers
23k views

.NET 4.5: internal error in the .NET Runtime (80131506) / disabling concurrent GC

I have a long-running .NET 4.5 application that crashes randomly, leaving the message I've mentioned in the question title in the event log. The issue is reproduced on 3 different machines and 2 ...
HellBrick's user avatar
  • 557
23 votes
1 answer
1k views

Why does Json.NET require System.Xml.Linq v5.0.5 for serialization of a simple object?

I have the following object: public class ProjectInfo { public string ConnectionStringName { get; set; } public string DefaultEntityNamespace { get; set; } public string ...
jgauffin's user avatar
  • 101k
23 votes
2 answers
6k views

Why does MemoryCache throw NullReferenceException

Update See updates below, issue is fixed the moment you install .Net 4.6. I want to implement something within the UpdateCallback of CacheItemPolicy. If I do so and test my code running multiple ...
MichaC's user avatar
  • 13.2k
22 votes
4 answers
29k views

'Forms' is not a member of 'Windows'

I tried to change the Target Framework on my app recently from .NET Framework 4.5 to 4.5.2, but if I do I get the following error when trying to build: "'Forms' is not a member of 'Windows'" (that is, ...
andre_ss6's user avatar
  • 1,245
22 votes
4 answers
19k views

Why is await async so slow?

I finally got VS2012 and got a simple demo up and working to check out the potential performance boost of async and await, but to my dismay it is slower! Its possible I'm doing something wrong, but ...
ohmusama's user avatar
  • 4,209
22 votes
2 answers
23k views

Wrong Content-Type header generated using MultipartFormDataContent

I have the following code: private static string boundary = "----CustomBoundary" + DateTime.Now.Ticks.ToString("x"); private static async Task<string> PostTest() { string servResp = ""; ...
Yan F.'s user avatar
  • 1,584
22 votes
6 answers
45k views

EF6 DBContext Dynamic Connection String

public partial class ProcessContext : DbContext { static ProcessContext() { Database.SetInitializer<ProcessContext>(null); } public ProcessContext() : base("Name=...
Gautham Nayak's user avatar

1 2
3
4 5
79