.net-4.0

Installing Asp.Net SignalR error while installing

*爱你&永不变心* 提交于 2019-12-07 10:52:43
问题 I am trying to install SignalR in Visual Studio 2010 professional project. But I am getting this error: Could not install package 'Microsoft.Owin.Security 2.1.0'. You are trying to install this package into a project that targets ' .NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. F or more information, contact the package author. 回答1: Try installing a different version of signal r with this command

How to propagate a Task's Canceled status to a continuation task

淺唱寂寞╮ 提交于 2019-12-07 10:48:43
问题 I am using the Task Parallel Library in my application. I have a Task (let's call it "DoSomething") which may be canceled. Whether the task is faulted, canceled, or completes successfully, I have a continuation attached to that task which performs some cleanup. In the code that launches this task, I want to return a Task object whose status (faulted, canceled, ran to completion) reflects the status of the DoSomething task, however it's important that this task I return not reflect this status

Dynamically calling 32-bit or 64-bit DLL from c# application using Environment.Is64BitProcess

给你一囗甜甜゛ 提交于 2019-12-07 10:12:45
问题 I am working on a project written in C# for .NET 4.0 (via Visual Studio 2010). There is a 3rd party tool that requires the use of a C/C++ DLL and there are examples for 32-bit applications and 64-bit applications in C#. The problem is that the 32-bit demo statically links to the 32-bit DLL and the 64-bit demo statically links to the 64-bit DLL. Being a .NET application it could run as either a 32-bit or 64-bit process on the client PCs. The .NET 4.0 framework provides the Environment

When is .net object = null game for garbage collection? Does scope matter?

徘徊边缘 提交于 2019-12-07 10:02:19
问题 Folks, If I set a large object to .net to null in the middle of a long-running method (not necessarily CPU intensive...just long-running) is it immediately game for garbage collection OR does the method need to complete before the object is ready for garbage collection? 回答1: The method doesn't need to complete, but neither do you need to set the variable to null, if the GC can tell you're not going to read from it again. For example: public void Foo() { SomeObject x = new SomeObject(); //

Covariance beats concrete type?

二次信任 提交于 2019-12-07 09:46:24
问题 to be honest- ive asked (a part of this question) here but now i have a different - related question. public class Base { public void Foo(IEnumerable<string> strings) { } } public class Child : Base { public void Foo(IEnumerable<object> objects) { } } List<string> lst = new List<string>(); lst.Add("aaa"); Child c = new Child(); c.Foo(lst); (n C# 3 it will call : Base.Foo in C# 4 it will call : Child.Foo ) Im in FW4 ! , lets talk about it with all the respect to covariance : when I write c.Foo

Winforms ReportViewer and setting parameters properly for ServerReport

时间秒杀一切 提交于 2019-12-07 09:13:23
问题 I'm setting parameters for a report that I'm showing in ReportViewer control, and the parameters are setting properly and the report is running with the proper parameters, however the actual controls that provide the report criteria at the top of the ReportViewer are not selected. Why aren't the proper items selected in the criteria, even when the report is properly running with the criteria that I set? ReportParameter month = new ReportParameter("month", "September 2011"); SsrsReportInfo

ASP.Net using wrong web.config for virtual directory

戏子无情 提交于 2019-12-07 08:58:30
问题 We're running IIS 6 on Windows Server 2003 R2. We want to add a virtual directory that runs under .NET 4.0 to a site that runs under .NET 2.0. We've given the virtual directory its own app pool, and we've configured the virtual directory to run under 4.0. The parent site works fine, but the virtual directory throws errors that reference the parent site's web.config file. We need the virtual directory to use its own web.config file. The GUI in the IIS Manager says that the virtual directory is

Debugging .Net4 COM registered assembly from Win32 caller in Visual Studio 2010

大憨熊 提交于 2019-12-07 08:56:54
问题 This is a very simple setup, I can't believe but I didn't find anybody with the same problem so far... Create a .Net4 class library in VS2010. Create a simplest possible COM object: [ComVisible(true)] [Guid("CD157EBC-C89D-40b6-B531-E85FF4B3AE9A")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IAcorn { bool Foo(string moo); } [ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] [Guid("854B7690-C1C4-40c4-8059-B4F3450B30D0")] public class Acorn : IAcorn { public

automatic replacement of text in wpf richtextbox

风格不统一 提交于 2019-12-07 08:08:58
问题 I have a WPF .NET 4 C# RichTextBox and I'm wanting to replace certain characters within that text box with other characters, this is to happen on the KeyUp event. What I'm trying to achieve is replace acronyms with full words, e.g.: pc = personal computer sc = starcraft etc... I've looked a few similar threads, but anything I've found hasn't been successful in my scenario. Ultimately, I'd like to be able to do this with a list of acronyms. However, I'm having issues with even replacing a

DLR and Javascript interpretation in c# 4?

橙三吉。 提交于 2019-12-07 07:43:10
问题 I want to execute a javascript code from c# using DLR. So I wrote a simple code using c# and Jint : var script = @" function show( ) { return parseInt('123asd'); //in js it's 123 }; return show();"; var result = new JintEngine().Run(script); Console.WriteLine(result); parseInt('123asd') in javascript is : 123 But the result I get is : Maybe I don't see the whole picture, but if a programmer on the other side of the world sends me his script file, I (and him) expect the result to be consistent