It seems that these code snippets ought to behave identically:
1: Monitor.TryEnter(object)
if (Monitor.TryEnter(lockObject))
{
try
{
DoSomething();
}
finally
{
Monitor.Exit(lockObject);
}
}
2: Monitor.TryEnter(object, ref bool) - introduced in .NET 4.0
bool lockAcquired;
try
{
Monitor.TryE...
I was just wondering if anyone has successfully got Spark to work in a .NET 4.0 console application for compiling templates to HTML. Unfortunately I am getting the following error:
Unhandled Exception: Spark.Compiler.CompilerException: Dynamic view compilation failed.
(0,0): error CS1703: An assembly with the same identity 'mscorlib, V...
I've got a Canvas and I put some stuff on it, then I scaled it. But, when you run the scales, they don't originate from the point they should, like, if you scale it from one origin a bit, then scale from another origin, the second origin acts as if it's been offset somewhat in a really strange fashion instead of behaving as intended (and...
I'm running VS2010 pro, and I downloaded a sample Silverlight app (found here: http://tinyurl.com/26brhfx) written in an older version. I did the conversion but now when I go to run it, I get this error. I searched the net, the only recommendation I found was to add a reference to "System.Net" (which didn't make sense, but I did anyway...
I'm trying to do like this:
public int Insert(object o, string[] ignore = new string[] {"Id"})
but it tells me that I can't do that ?
why is that so ?
...
I am developing a WPF application in .NET 4.0 which calls a WCF Service hosted on the server developed in .NET 4.0.
I want to use windows authentication for this purpose and it seems that it is not working and keep on giving me following error.
The provided URI scheme 'http' is
invalid; expected 'https'. Parameter
name: via
I...
I'm iterating through all the children of a given Canvas object. The trouble is, it's only impacting one of the two children. The other iteration I have in another similar event is working just fine. I've got this so that you can drag the elements:
private Point lastmousepoint;
private void Window_MouseMove(object sender, Mou...
In dotNET with C# 4.0, How can I ensure that event that happens on an arbitrary thread X will call handlers in the same thread (or synchronization context) as the subscribing thread A, B, or C.
I am trying to avoid having to put in threading-related code into handler method or event site.
It would be really great if I wouldn't have to ...
I went through MSDN pages to learn ADO.Net using Commands. I am able to read using the sample code posted there.
But when I tried to use the modification code below, the insert is not happening. I am not ale to figure out why. Can someone please tell me what is wrong with this code?
string connectionString = "A_VALID_CONNECTION_STRING"...
I'm facing problems trying to expose a simple WCF 4.0 service as a restful. It's SOAP part works fine. My operation contract is marked with [WebGet(UriTemplate="example/{param}")]
and my web.config contains the folowing
<services>
<service name="Service1">
<endpoint address="data" binding="webHttpBinding" behaviorConfigurati...
I created my Entity Model in a class library project and added references to this project from other projects in my solution.I generated POCOs from the Model. All is good so far.
I added a WCF service application to this solution and referenced the data model project. The data model project, named "DataModel", is now unresolved and I ge...
As in the following link, one can stop, start, and "stop, then start" a service using C# code.
http://www.csharp-examples.net/restart-windows-service/
I have baked a .Net service that does implement OnStart and OnStop. However, I need to implement a "smart restart" functionality which is more involved than just stopping and then starti...
Hi Geniuses
I got a complicated problem with ASP.Net 4.0 Ajax....I started a website with Visual Studio 2010 on my machine,and added some update panels they used to work fine,but suddenly i got that series of errors when i run my website
Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load.
Micros...
Please, help me to explain the following behavior:
dynamic d = 1;
ISet<dynamic> s = new HashSet<dynamic>();
s.Contains(d);
The code compiles with no errors/warnings, but at the last line I get the following exception:
Unhandled Exception: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.Collections.Generic.ISet<object>'...
I have a project using DevExpress 8.3 (2008.3) which I just recently upgraded to use VS 2010. After doing so, everything compiled fine but I got errors trying to use the designer. I resolved this as described here:
http://stackoverflow.com/questions/2637089/netfx40-legacysecuritypolicy-in-design-time-mode
by adding <NetFx40_LegacySecur...
I am currently developing a WCF service .net 4.0 which has got 2 properties. For some reason those property is not visible on the client.
Following is the code for the service.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.We...
Can anyone reliably get the EntityDataSource to save a nullable column to the databse as a "null" when bound to any of the controls, such as "FormView"?
I have tried using several different UpdateParameters (SessionParameter, ControlParamater, Parameter, etc). I have tried setting "ConvertEmptyStringToNull" to true and leaving the prop...
I need to build a blocking priorty queue and my hunch is that TakeFromAny may be the secret ingredient, however the documentation on that method is sparse. What is its purpose / appropriate use/
My requirement is that multiple threads will add to either a high priority or low priority queue. One thread will consume these two queues alw...
I wish to highlight the columns on a WPF datagrid as the mouse moves. Some of the problems I face are:
Getting the coordinates of columns to test for when the mouse is over them
Changing the background color of a column
Any help will be much appreciated.
...
I'm reading a string into a dataset using the ReadXML method. When I try that it returns an Invalid Characters in the path error. if I save and open the string in IE as an xml file it erros on the encoding="UTF-16" line so I assume that is the cause of the problem.
Is there a simple way to fix this? Shouldn't it be able to handle unico...