.net-4.0

RuntimeBinderException - C# .NET 4 Dynamic Keyword - Help Me Understand Why Method Isn't Matching

I've built a generic config system for an HttpModule that allows pluggable HTTP header inspectors. For reference, here is the basic layout of the code -- this should be enough to get a feel for what I'm doing: public interface IHttpHeaderInspectingAuthenticatorFactory<T> where T: HttpHeaderInspectingAuthenticatorConfigurationElemen...

<%: %> brackets for HTML Encoding in ASP.NET 4.0

Accidentally I found this post about a new feature in ASP.NET 4.0: Expressions enclosed in these new brackets <%: Content %> should be rendered as HTML encoded. I've tried this within a databound label in a FormView like so: <asp:Label ID="MyLabel" runat="server" Text='<%: Eval("MyTextProperty") %>' /> But it doesn't work: The text ...

What are the major differences between NET Frameworks 3.5 and 4.0?

Possible Duplicates: Things in .NET Framework 4 that every programmer should know Basic difference between .net 3.5 and 4.0 Hi Guys Is there any real great (really good) difference between NET Framework 3.5 and NET Framework 4.0? Perhaps something regarding performance? thank you ...

How to convert a vb.Net 4.0 project to C# 4.0 project?

I looked into: http://www.developerfusion.com/tools/convert/vb-to-csharp/ as well as: http://www.icsharpcode.net/opensource/sd/ but neither does exactly what I want. EDIT: The first link translates only the source code (.vb) and does a good job at it. I also need to convert the project. The second link ... #develop does not handle...

NHibernate, the Parallel Framework, and SQL Server

hey guys, we have a loop that: 1.Loops over several thousand xml files. Altogether we're parsing millions of "user" nodes. 2.In each iteration we parse a "user" xml, do custom deserialization 3.finally, in each iteration, we send our object to nhibernate for saving. We use: .SaveOrUpdateAndFlush(user); This is a lengthy process, an...

Updating fields of values in a ConcurrentDictionary

I am trying to update entries in a ConcurrentDictionary something like this: class Class1 { public int Counter { get; set; } } class Test { private ConcurrentDictionary<int, Class1> dict = new ConcurrentDictionary<int, Class1>(); public void TestIt() { foreach (var foo in dict) { foo...

.Net: Microsoft Duwamish sample running with .Net framework 4.0?

hi all I'm looking for Duwamish sample for .Net framework 4.0. But it seems that project needs .Net framework V1.1 SDK. What are your suggestion? Are there any other complete and known project running with .net framework 4.0? ...

log4net and .net Framework 4.0

Hi Guys, I was having issues in log4net when i updated my solutions to .net 4.0 , and then i downloaded the source of it and built log4net and targeted it to .net 4.0 and used it in my projects. initially when i referred log4net that is targeted to run time 2.0 it complied and run the application but log did not work. now when i run m...

New cast exception with VS2010/.Net 4

[ Updated 25 May 2010 ] I've recently upgraded from VS2008 to VS2010, and at the same time upgraded to .Net 4. I've recompiled an existing solution of mine and I'm encountering a Cast exception I did not have before. The structure of the code is simple (although the actual implementation somewhat more complicated). Basically I have: ...

Calling a WPF Application and modify exposed properties?

I have a WPF Keyboard Application, it is developed in such a way that an application could call it and modify its properties to adapt the Keyboard to do what it needs to. Right now I have a file *.Keys.Set which tells the application (on open) to style itself according to that new style. I know this file could be passed as a command line...

Error - Cannot find static resource in a WPF application

I'm learning WPF and started with this MSDN tutorial. I was just following the tutorial. When I finished the code as per the tutorial and try to run I get an exception in a XAML page which says "'Provide value on 'System.Windows.StaticResourceExtension' threw an exception.' Line number '27' and line position '55'." . And inner exception...

Lambda expressions - set the value of one property in a collection of objects based on the value of another property in the collection

I'm new to lambda expressions and looking to leverage the syntax to set the value of one property in a collection based on another value in a collection Typically I would do a loop: class Item { public string Name { get; set; } public string Value { get; set; } } void Run() { Item item1 = new Item { Name = "name1" }; I...

For single-producer, single-consumer should I use a BlockingCollection or a ConcurrentQueue?

For single-producer, single-consumer should I use a BlockingCollection or a ConcurrentQueue? Concerns: My goal is to pull up to 100 items at a time and send them as a batch to the next step. If I use a ConcurrentQueue, I have to manually cause it to go asleep when there is no work to be done. Otherwise I waste CPU cycles on spinning. ...

Entity Framework conditional mapping operator other than = and is

Is it possible to create an EntitySet with a conditional mapping other than Value or IsNull? Suppose we have have a Product object with a field DateTime Expiration. I want to have ExpiredProducts and ActiveProducts based on Expiration>DateTime.Now so I can query like this: var expired = from p in ExpiredProducts select p; ...

RegLoadAppKey working fine on 32-bit OS, failing on 64-bit OS, even if both processes are 32-bit

I'm using .NET 4 and the new RegistryKey.FromHandle call so I can take the hKey I get from opening a software registry file with RegLoadAppKey and operate on it with the existing managed API. I thought at first it was just a matter of a busted DllImport and my call had an invalid type in the params or a missing MarshalAs or whatever, bu...

How can I add dll to the GAC?

running gacutil.exe /i ProjectX.Core.dll, I got the message: Assembly sucessfully added to te cache, but I can't see this assembly in the c:\windows\assembly folder. What can be the problem? ...

PHP cannot find .net assembly in the .net-4 GAC

<?php $console = new DOTNET("ProjectX.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=KeyTokenHere-i used a real value here", "ProjectX.Core.Services.ServicX"); echo '1'; ?> The error message: Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80070002] The s...

Why does Trace.WriteLine("Test") not appear when targeting .net 4.0 but does when 3.5

I have just noticed that when i call the following code from a console app for (int i = 0; i < 10; i++) { Trace.WriteLine("Logging"); Debug.WriteLine("Logging Debug"); } if I am targeting .net 4.0 no messages appear in the debugview app although I am capturing all outputs. If I change to target 3.5 it appears fine. What's change...

Change C++/CLI project to another framework than 4.0 with vs2010

Since I upgraded my project to visual studio 2010 project format, my C++/CLI project is targeted to .net framework 4.0. It is easy to switch the framework version to another version from a C# project, but I have no clue how to do this in a C++/CLI project, I see no setting for this in the project property pages. ...

Why aren't classes in .NET 4 covariant?

Possible Duplicate: Why isnt there generic variance for classes in C# 4.0? As a rookie programmer I have a couple of questions about variance in .NET 4. Not so much about how it works, but why certain things are not variant and if other people would find this useful. Question 1: I know that interfaces and delegates can be c...