.net-4.0

Attempt by method 'System.Web.Helpers.Json.Decode(System.String)' to access field 'System.Web.Helpers.Json._serializer' failed

折月煮酒 提交于 2019-12-05 15:50:52
I have the following JSON; { "b2c": { "languages": { "de": { "models": { "t300": { "name": "Aveo", "bodyTypes": { "t300-4d-my13": { "trimLevels": { "lt": { "name": "LT", "variants": { "1.2_16V_86_Gas_MT": { "name": "1.2 MT", "price": { "EUR": { "value": 13990, "formatted": "13.990,00 €" } }, "infoFeatures": { "fuel_consumption_extra_urban#consumption": { "name": "Kraftstoffverbrauch außerorts ", "value": "4.6", "formatted": "4,6" }, "top_speed#kilometer_per_hour": { "name": "Höchstgeschwindigkeit", "value": "171", "formatted": "171" } }, "images": null, "documents": null } } } } } } } } } } }

Task<T> vs Asynchronous delegates in c#?

时光毁灭记忆、已成空白 提交于 2019-12-05 15:46:42
问题 I have this simple method : static int Work (string s) { return s.Length; } I could run it with : Task<string> task = Task.Factory.StartNew<int> (() => Work ("lalala") ); ... int result = task.Result; Or with this : Func<string, int> method = Work; IAsyncResult myIasync= method.BeginInvoke ("lalala", null, null); ... int result = method.EndInvoke (myIasync); They both use a threadpool thread. Both wait the execution to finish ( when reading the value) Both rethrow any exception to the caller.

MEF: difference between GetExportedValue and SatisfyImports

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 15:41:24
We're using MEF (.NET 4, can't use 4.5 at the moment) in a MVVM application. Everything was fine until we needed to create models on the fly, for instance editable rows of a table. I didn't want to run into memory leaks, I found this article http://pglazkov.blogspot.ch/2011/04/mvvm-with-mef-viewmodelfactory.html and I discovered an unexpected behavior that I would like to understand. This is an Item added to the Shell.Items observable collection: [PartCreationPolicy(CreationPolicy.NonShared)] [Export] public class Item : INotifyPropertyChanged, IDisposable { [Import] private Lazy<Shell> shell;

Derived method stronger than override in c#?

你说的曾经没有我的故事 提交于 2019-12-05 15:18:12
( again annoying question... ) after asking this before - ( which is partly related to my question) - i got an answer : See §7.6.5.1 of the C# 4 spec: The set of candidate methods is reduced to contain only methods from the most derived types: For each method C.F in the set, where C is the type in which the method F is declared, all methods declared in a base type of C are removed from the set. ok. i have this code : // .Dump() is like a WriteLine command... public class Base { public void Foo(string strings) { "1".Dump();} public virtual void Foo(object strings) { "2".Dump();} } public class

How do I find out the actual SQL that this statement generates?

一世执手 提交于 2019-12-05 14:53:20
I an using VS2010, .NET4 and EF4. I would like to see the actual SQL that is generated when this is run. Also, what is this the best way to write this statement? Here is my code: var cklContactItems = from a in dbTestCenterViews.appvuChecklistExports where a.MarketChecklistID == MCLID && a.checklistSectionID == SID && a.fieldGroupOrder != null orderby a.fieldGroupOrder ascending select new { a.Column1, a.Column2, a.Column3, a.Column4, a.Column5,a.Column1FieldID,a.Column2FieldID,a.Column3FieldID,a.Column4FieldID,a.Column5FieldID,a.fieldGroupOrderLabel }; var query = (from x in context.MyEntity

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

那年仲夏 提交于 2019-12-05 14:45:44
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? 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(); // Code which uses x Console.WriteLine("Eligible for collection"); // Code which doesn't use x. } The object is

WCF Exists and partially working but for some calls returns “no endpoint listening - (404) Not Found.”

筅森魡賤 提交于 2019-12-05 14:41:58
问题 We have service that's working with small to large sets of data (document generation), and it's working fine for some calls, but for some specific requests (exact same method, different arguments) it just returns: System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:8010/MyService/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System

Using PHP to authenticate users in an ASP.NET membership

怎甘沉沦 提交于 2019-12-05 14:14:08
I'm having some issues when trying to authenticate users against an existing ASP.NET membership database using PHP. I've searched the web and the existing answers that I've found don't seem to be working for me. Namely: public static function Hash($password, $salt) { $decodedSalt = base64_decode($salt); $utf = mb_convert_encoding($password, 'UTF-16LE', 'UTF-8'); return base64_encode(sha1($decodedSalt.$utf, true)); } I think that part of the issue is that the password hashes aren't actually being computed with SHA-1, since the values in the database are 44 character long, base64 encoded strings

Did P/Invoke environment change in .NET 4.0?

≡放荡痞女 提交于 2019-12-05 13:38:41
问题 I've started upgrading a .NET 2.0 WinForms application to .NET 4.0. Well, OK, the upgrade process was just a matter of switching platform target, but making it actually work. I assumed that's all there would be to it. But it seems that something drastically changed in .NET 4.0 regarding interop. Using DllImport(), the application embeds a couple Delphi dlls. When the application targets .NET 2.0, everything works normally. But when I changed it to target .NET 4.0, stuff starts going haywire,

Installing Asp.Net SignalR error while installing

孤者浪人 提交于 2019-12-05 13:32:29
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. Try installing a different version of signal r with this command (via nuget package console) 'install-package Microsoft.AspNet.SignalR -Version 1.1.3'. Latest version of