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
3,925
questions
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:
...
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 ...
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 ...
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, ...
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 ...
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&...
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 ...
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 ...
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 ...
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
...
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, ...
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 ...
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 ...
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.
...
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. ...
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 ...
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 ...
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 ...
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 ...
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[]
{...
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://...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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-...
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 ...
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 ...
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 ...
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 ...
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.
...
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 ...
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();
...
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 ...
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 = ...
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 ...
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;
...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 = "";
...
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=...