.net-4.0

Analogue of Queue.Peek() for BlockingCollection when listening to consuming IEnumerable<T>

試著忘記壹切 提交于 2019-12-18 21:16:52
问题 I'm using Pipelines pattern implementation to decouple messages consumer from a producer to avoid slow-consumer issue. In case of any exception on a message processing stage [1] it will be lost and not dispatched to an other service/layer [2] . How can I handle such issue in [3] so message will not be lost and what is important! order of messages will not be mixed up so upper service/layer will get messages in the order they came in. I have an idea which involves an other intermediate Queue

WIX Custom Actions built for .Net Framework 4.0 does not work? Ways to resolve?

泪湿孤枕 提交于 2019-12-18 19:10:09
问题 We were using WIX 3.5 (Build Number 1811) and built a custom action built using Visual Studio 2008 and with target framework as .Net 3.5. This used to work great, until we built the custom action using Visual Studio 2010 and with target framework as .Net 4.0. WIX is unable to invoke the custom action, the error that we get is this: SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSI69BD.tmp-\ SFXCA: Binding to CLR version v2.0.50727 Calling custom action

Bound WPF TextBox is not updating value when the bound property enforces some business rules

北慕城南 提交于 2019-12-18 17:14:24
问题 I am using .NET 4.0. I have some very simple code that lets the user type in a number between 1 and 99,999 (inclusive). I have some logic in the Property setter that prevents the latest value from being applied if it does not adhere to the business rules (e.g., it is not a number or the number is too large). public class MainViewModel : INotifyPropertyChanged { #region Fields private string _text = string.Empty; #endregion // Fields #region Properties public string Text { get { return _text;

Exposing C# COM server events to Delphi client applications

情到浓时终转凉″ 提交于 2019-12-18 17:07:42
问题 My question is very similar to these two: C# component events? C# - writing a COM server - events not firing on client However, what worked for them is not working for me. The type library file, does not have any hints of events definitions, so Delphi doesn't see it. The class works fine for other C# applications, as you would expect. COM Server tools: Visual Studio 2010 .NET 4.0 Delphi applications: Delphi 2010 Delphi 7 Here's a simplified version of the code: /// <summary> /// Call has

Could not load type 'System.Web.Mvc.ViewUserControl<SOMETYPE>'

不想你离开。 提交于 2019-12-18 15:30:52
问题 I'm trying to deploy ASP.NET MVC 2 project (VS2010) to Win Server 2008 R2 It works perfectly on dev machine. But strange error occurs at Server 2008 R2: When .ascx file has header that uses generic type: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel>" %> Server reports Could not load type 'System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel>'. But when I declare somewhere in .cs file type like public class AA : System.Web.Mvc

Could not load type 'System.Web.Mvc.ViewUserControl<SOMETYPE>'

ε祈祈猫儿з 提交于 2019-12-18 15:29:13
问题 I'm trying to deploy ASP.NET MVC 2 project (VS2010) to Win Server 2008 R2 It works perfectly on dev machine. But strange error occurs at Server 2008 R2: When .ascx file has header that uses generic type: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel>" %> Server reports Could not load type 'System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel>'. But when I declare somewhere in .cs file type like public class AA : System.Web.Mvc

Difference between dynamic and System.Object

六月ゝ 毕业季﹏ 提交于 2019-12-18 14:48:30
问题 What is the difference between a variable declared as dynamic and a variable declared as System.Object? Running the following function would seem to indicate that both variables get cast to the correct type dynamically: void ObjectTest() { System.Object MyTestVar = "test"; dynamic MyTestVar2 = "Testing 123"; Console.WriteLine("{0}", MyTestVar.GetType()); Console.WriteLine("{0}", MyTestVar2.GetType()); MyTestVar = 123; MyTestVar2 = 321; Console.WriteLine("{0}", MyTestVar.GetType()); Console

Datetime issues with Mongo and C#

☆樱花仙子☆ 提交于 2019-12-18 14:48:19
问题 I'm having an issue with saving and retrieving dates with Mongo using the c# driver. For some reason it it's truncating the ticks. When I store this: DateTime -> 5/17/2011 7:59:13 PM Ticks -> 634412591533741650 I get this back: DateTime -> 5/17/2011 7:59:13 PM Ticks -> 634412591533740000 So if I try to do: serverDateTime == mongoDateTime It always fails. Anyway around this? 回答1: The reason is that the BSON DateTime format stores values with less precision than a .NET DateTime value, so when

What's the supportedOS GUID for Windows 10?

…衆ロ難τιáo~ 提交于 2019-12-18 14:41:13
问题 We're detecting the OS version for statistics. Starting with Windows 8.1, the OS "lies" about its version when using GetVersion . However, System.Environment.OSVersion still calls this API as of .NET 4.5.1. As such, we've added 8.1's GUID to the manifest, which works great. Now, I'd like to prepare the same for Windows 10. Is the GUID for this known yet? (edit) P/Invoking VerSetConditionMask and VerifyVersionInfo to check for 6.4 or greater does appear to work. 回答1: <!-- This Id value

Task LongRunning side effects?

ⅰ亾dé卋堺 提交于 2019-12-18 14:04:03
问题 If a Task is created using the LongRunning option are there any side effects as they do not use the ThreadPool 回答1: Yes . Side effect is that: if you have a million tasks, you could potentially create a million threads. Need to take into account that each thread will bring its memory overhead and context switching overhead. Memory overhead is not that small, we are talking a few MB here so even with thousands of items, you could run into trouble. 回答2: The LongRunning option is a hint to the