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
18
votes
2
answers
24k
views
MVC and Entity Framework Html.DisplayNameFor with Composite ViewModel
I’m fairly comfortable with MVVM using WPF/Silverlight but this is my first attempt at an MVC Web Application…just an fyi for my background.
I’ve created a controller called TestSitesController which ...
18
votes
1
answer
4k
views
DLLs loaded from wrong AppplicationBase when trying to load mixed C# and C++/CLI dlls in a new AppDomain
We have a large .NET solution with both C# and C++/CLI projects which reference each other.
We also have several unit testing projects. We've recently upgraded from Visual Studio 2010 & .NET 4.0 ...
18
votes
1
answer
12k
views
4.6.1 framework update leaves web.config httpRuntime still at 4.5?
i recently upgraded our c# Web Applications to use .net framework 4.6.1 from 4.5 and only today noticed in the web.configs the .net version differs from the .net version.
Everything seems to work ...
18
votes
4
answers
5k
views
"routes.LowercaseUrls = true;" does not work?
I'm having trouble in setting my routes to lowercase by default. For some reason it does not work. I know I can set authorize and home to lowercase myself, but the Admin part (area) will still be ...
17
votes
3
answers
14k
views
Why does Task.Delay() allow an infinite delay?
After my application froze I tracked down the cause to a thread waiting on a task created by Task.Delay() (or TaskEx.Delay() in .NET 4.0) for which it provided a computed TimeSpan that, due to a bug, ...
17
votes
7
answers
3k
views
Issue Installing Entity Framework 7 RC1
I 'm trying to install EF7 rc1 to an existing project:
PM> Install-Package EntityFramework.MicrosoftSqlServer –Pre
but I get the following error:
Install failed. Rolling back...
Package '...
17
votes
2
answers
16k
views
When to use LINQ's .ToList() or .ToArray()
After running this code:
var input = new List<T>( ... );
var result = input.Select( t => new U(t) );
U first1 = null;
foreach ( U u1 in result )
if ( first1 == null )
first1 = ...
17
votes
2
answers
7k
views
What difference does it make - running an 'async' action delegate with a Task.Run (vs default action delegate)?
I am trying to get my head around async/await and thought I did understand few things about the usage. But still not quite clear what would be the actual benefit in a scenario like below.
Look at the ...
17
votes
1
answer
3k
views
Why does 'Any CPU (prefer 32-bit)' allow me to allocate more memory than x86 under .NET 4.5?
According to many SO answers and this widely cited blog post, a .NET 4.5 application built for 'Any CPU' with the 'prefer 32-bit' option selected will run as a 32-bit process on both 32-bit and 64-bit ...
17
votes
2
answers
7k
views
Visual studio 2013 + .Net 4.5.1 + Edit and continue 64 bit: not working
Supposedly vs 2013 added support for edit and continue 64 bit (see http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/26/debugging-support-for-64-bit-edit-and-continue-in-visual-studio-2013.aspx)....
17
votes
2
answers
4k
views
Has Airspace Support Definitely Been Dropped in WPF 4.5?
As I write this question, 2 days after the beta of .NET 4.5 was released, the What's New in WPF 4.5 Version 4.5 Beta page on MSDN still lists "Integrating WPF with win32 Graphical User Interfaces" as ...
17
votes
3
answers
2k
views
Catch block is not being evaluated when exceptions are thrown from finallys
This question came about because code that worked previously in .NET 4.0 failed with an unhandled exception in .NET 4.5, partly because of try/finallys. If you want details, read more at Microsoft ...
17
votes
1
answer
7k
views
SignalR and Websockets on Mono
I've done hours of scouring, trying to figure out why the websockets transport doesn't work through signalr on my c# 4.5 application running on linux via mono 4.0.1.
References in my project:
...
17
votes
1
answer
14k
views
How many threads Parallel.For(Foreach) will create? Default MaxDegreeOfParallelism?
I want to know, how many threads will be used when I run Parallel.For/ForEach loop.
I found, that it can be changed by MaxDegreeOfParallelism option.
MaxDegreeOfParallelism help on MSDN says (link):
...
17
votes
3
answers
31k
views
.NET 4.5 RC Framework CLR - Windows XP compatibility
My question in short is: "Can .NET framework 4.5 be installed on Windows XP machines?"
I have the following MSDN link:
.NET Framework Versions and Dependencies
Each new version of the .NET ...
17
votes
1
answer
22k
views
WCF .NET 4.5 on Windows Server 2008 R2
In Windows Server 2008 R2, I cannot activate WCF Http/Tcp Activation windows features for .net 4.5 from Server Manager
Server manager in Windows Server 2008 R2 does not support .net 4.5, even though ....
17
votes
5
answers
18k
views
Does Visual Studio 2010 support .NET 4.5 CTP?
... or do I absolutely need Visual Studio 11 Developer Preview?
I'm mostly concerned with ReSharper support; 6.1 EAP isn't available yet.
I'm going to be making a WPF 4.5 greenfield application (as ...
17
votes
1
answer
1k
views
Why would an empty delegate event handler cause a CA1061 warning?
Update: This occurs when the Code Analysis option "Suppress results from generated code (managed only)" is turned off, and Rule Set is set to "Microsoft Basic Design Guideline Rules".
On 2013-04-26, ...
16
votes
3
answers
7k
views
.NET 4 equivalent of Task.WhenAll()
In .NET 4, is there any functional equivalent to .NET 4.5's System.Threading.Tasks.Task.WhenAll()?
The goal is to wrap up multiple async tasks into a single one that is completed when all of its ...
16
votes
5
answers
12k
views
Place holder or watermark in TextBox windows 8
I want to show a placeholder text in TextBox when user hasn't typed anything and TextBox is idle.
In Andriod it can be done using android:hint="some Text"
In iPhone it can be done as textFild....
16
votes
5
answers
11k
views
Why does TextBlock trims ending spaces from the text?
Here are my TextBlocks:
<StackPanel Orientation="Horizontal" Margin="0,3,0,0">
<TextBlock Text="6 or more characters, at least one letter and a number, " ...
16
votes
2
answers
30k
views
Dlls not deployed to GAC - SharePoint 2013, Visual Studio 2012, .Net FW 4.5
When I create a simple SharePoint 2013 project in Visual Studio 2012 and I want to deploy it, it deploys fine, but Dll is not in the Global Assembly Cache. In Advanced tab, I have added project ...
16
votes
1
answer
30k
views
Deserialize a property as an ExpandoObject using JSON.NET
For example, there's an object like the next one:
public class Container
{
public object Data { get; set; }
}
And it's used this way:
Container container = new Container
{
Data = new ...
16
votes
1
answer
17k
views
Loading .NET UserControls in IE with .NET 4.5
There is a similar question: Loading .NET UserControls in IE with .NET 4.0 This question is essentially the same, but for .NET 4.5
That question starts with:
I've got a legacy app where there's a ...
16
votes
3
answers
26k
views
Enum Support for Entity Framework Database First
I can find a bunch of tutorials on how to implement enum support for model first and code first like these:
http://msdn.microsoft.com/en-us/data/jj248772.aspx
http://msdn.microsoft.com/en-us/data/...
16
votes
2
answers
50k
views
.NET Framework 4.5 operating system requirements (no Vista and XP) [closed]
Currently, the .NET Framework 4.5 runs only on Windows 7 and above:
Operating system Version 4.5 Beta
--------------------------------------------------------
Windows 8 ...
16
votes
3
answers
9k
views
MVC4 + async/await + return response before action completes
In my MVC4 app I need to add a controller for uploading and processing large files. Immediately after the file is uploaded I need to start async processing of that file and return response to the ...
16
votes
1
answer
1k
views
Why HashSet<T> does not implement IReadOnlyCollection<T>?
I've just found that .NET Fx now has 3 useful interfaces:
IReadOnlyCollection<T>
IReadOnlyList<T>
IReadOnlyDictionary<K,V>
And I'm bit confused why HashSet<T> do not ...
16
votes
5
answers
35k
views
visual studio 2013 on windows xp
Is it possible to run Visual Studio 2013 on Windows XP?
I heard that it is not possible to install .NET Framework 4.5 on Windows XP. What if I want to use Visual Studio 2013 for .NET 4.0 on Windows ...
16
votes
1
answer
585
views
.Net 4.5 killed my TPL, now what?
Exhibit 1: some code wrapping an Async (not async!) network call into a Task
public static Task<byte[]> GetAsync(IConnection connection, uint id)
{
ReadDataJob jobRDO = new ReadDataJob();
...
16
votes
2
answers
12k
views
How do I kick off an entity stored procedure in EF6 async and not wait for a return?
I'd like to just punt a call over to the SQL Server and not wait for a return. I have an imported Entity Function from a Stored Procedure that I'd like to call asynchronously this way in Entity ...
16
votes
3
answers
14k
views
C# have async function call synchronous function or synchronous function call async function
I'm writing a C# .Net 4.5 library for doing common sql database operations (backup, restore, execute script, etc.). I want to have both synchronous and asynchronous functions for each operation, as ...
16
votes
1
answer
4k
views
Using IReadOnlyCollection<T> instead of IEnumerable<T> for parameters to avoid possible multiple enumeration
My question is related to this one concerning the use of IEnumerable<T> vs IReadOnlyCollection<T>.
I too have always used IEnumerable<T> to expose collections as both return types ...
16
votes
5
answers
10k
views
WPF Maximized Window bigger than screen
When creating a WPF window with AllowsTransparency="True" WindowStyle="None" and maximizing it via this.WindowState = WindowState.Maximized; the Window gets bigger than my screen.
When setting ...
16
votes
3
answers
4k
views
What's the .NET 4.5 equivalent to UserNameWSTrustBinding?
I am converting a active profile STS to the new .NET 4.5 System.IdentityModel framework. My code using the UserNameWSTrustBinding which doesn't seem to exist in the new framework. Any suggestions.
15
votes
2
answers
16k
views
Task.Run and Func<>
How can I run a Task that return value and takes a parameter? I see that there is an overloaded method Task.Run<TResult>(Func<TResult>) but how I can pass a parameter there?
15
votes
1
answer
33k
views
The 'await' operator can only be used with an async lambda expression [duplicate]
I'm trying to copy a list of files to a directory. I'm using async / await.
But I've been getting this compilation error
The 'await' operator can only be used within an async lambda
expression. ...
15
votes
3
answers
36k
views
How to create new DataTable with column structure from other DataTable?
As in title - the question is:
How to create new DataTable with column structure from other DataTable?
I need empty DataTable to use .Rows.Add() method in it.
Code:
DataTable dtFirst = new ...
15
votes
5
answers
16k
views
Serialization breaks in .NET 4.5
We have a serialization issue which only happens in .NET 4.5 - same code works fine in .NET 4. we're trying to serialize an inherited type with a few fields, both base and inherited class are marked ...
15
votes
5
answers
2k
views
GZipStream machine dependence
I'm running into some strange machine/OS dependent GZipStream behavior in .NET 4.0. This is the relevant code:
public static string Compress(string input) {
using(var ms = new MemoryStream(...
15
votes
1
answer
10k
views
Why do I have to use await for a method to run asynchronously. What if I don't want to wait for the method to finish before continuing? [duplicate]
I've been pouring through MSDN docs all day, and their philosophy of asynchronous coding is confusing me. As I understand it, the thread that calls the async method will not be blocked if the async ...
15
votes
3
answers
8k
views
HTTPClient getting two 401s before success (sending wrong token)
I'm trying to communicate with a self-hosted WebAPI client using HttpClient. The client is created with the following code:
HttpClientHandler clientHandler = new HttpClientHandler()
{
...
15
votes
1
answer
10k
views
.Net 4.5 Svcutil generates two operations with the same name (Method and MethodAsync)
I am consuming a predefined wsdl with svcutil a la:
svcutil some_service.wsdl
one of the methods generated has the following signature:
[System.ServiceModel.OperationContractAttribute(Action="http:/...
15
votes
5
answers
15k
views
Compilation issue in Visual Studio 12 Professional with a C# project
The project worked fine in Visual Studio 2010, and we upgraded to Visual Studio 2012; however, now it does not compile.
We get the following error:
Error 2 Task could not find "AL.exe" using the ...
15
votes
1
answer
4k
views
How do I get to the SecurityTokenHandlers collection in WIF 4.5?
I am migrating an ASP.Net site that uses Active Federation and WIF 3.5 to use .Net 4.5. The functionality of Windows Identity Foundation (WIF 3.5) has now been fully integrated in into the .Net 4.5 ...
15
votes
1
answer
9k
views
Loading an assembly targeted for .NET 4.5 on a .NET 4.0 app domain
Assuming the system has .NET 4.0 and .NET 4.5 installed.
Is it possible to load and work with a .NET 4.5 assembly from an assembly written targeting .NET 4.0?
Simply put, can I call Assembly.Load ...
15
votes
1
answer
844
views
Entity Framework entity is not in DataSpace.OSpace (_workspace.GetItemCollection(DataSpace.OSpace)) but is in DataSpace.CSpace
I have been mucking around with XMLs for entity Framework. I tried to create a type of entity that could have properties injected at runtime,
First I created DynamicEntity object that is dynamic
...
15
votes
2
answers
9k
views
Does Task.Delay start a new thread?
The following code should (at least in my opinion) create 100 Tasks, which are all waiting in parallel (that's the point about concurrency, right :D ?) and finish almost at the same time. I guess for ...
15
votes
4
answers
2k
views
Code Contracts + Async in .NET 4.5: "The method or operation is not implemented"
I receive the following compilation error from ccrewrite when using Code Contracts 1.4.51019.0 in VS2012 on Windows 7 x64: "The method or operation is not implemented."
It appears to be caused by a ...
14
votes
1
answer
3k
views
.NET 4.5 CustomReflectionContext: what is it useful for?
What's New in the .NET Framework 4.5 Developer Preview mentions
Ability to customize a reflection context to override default
reflection behavior through the CustomReflectionContext class.
What ...