.net-4.0

Runtime-error in wpf with Window.AllowsTransparent set to true

风流意气都作罢 提交于 2019-12-12 12:55:16
问题 I get an exception thrown at runtime when I set AllowsTransparency="True" I get an exception saying the WindowStyle can not be set to None if AllowsTransparency is set to true. Even if I explicitly say that WindowStyle is set to SingleBorder I get this error. However, if I set WindowStyle to SingleBorder and remove the AllowsTransparency -tag, I get no error, and the top of the window (the icon, name and close, minimize and maximize-buttons) disappears. Anyone knows what can cause this? Or is

Using a .NET-2.0-targeted COM DLL in the GAC on a .NET-4-only system

烈酒焚心 提交于 2019-12-12 12:08:10
问题 Greetings again, Following up my previous question, I'm trying to maximize the compatibility of my C#-written Windows Explorer extension. In particular, I'm interested in making sure it works in an environment in which .NET 4 is installed and .NET 3.5 and below are not installed. One would think there's no problem, but apparently it's not so simple... There are two problems. First, non-.NET-4-targeted assemblies flat out will not load with CLR 4 unless they have a .config file that specifies

Is multi-level ConcurrentDictionary still thread-safe?

痞子三分冷 提交于 2019-12-12 11:54:49
问题 I have four level data structure defined like this: Dictionary<Type1, Dictionary<Type2, Dictionary<Type3, List<Type4>>>> The whole thing is encapsulated in a class which also maintains thread-safety. Currently it just locks whole collection while it reads/manipulates the data (reading is by orders of magnitude more common than writing). I was thinking of replacing the Dictionary with ConcurrentDictionary and List with ConcurrentBag (its items don't have to be ordered). If I do so, can I just

System.Drawing - Parameter is not valid

孤者浪人 提交于 2019-12-12 11:35:53
问题 After some more testing I've found that this problem may be due to the images somehow not being loaded in time to be cloned into bitmaps and displayed. Is this possible or no? NOTE: Yes, there are other questions with this error in the title, but from a bit of a research it seems to be an ambiguous error with many possible causes. I haven't found any questions with the same scenario as mine. I'm getting the following error. System.ArgumentException was unhandled HResult=-2147024809 Message

Serialize List<Func<T>>

落花浮王杯 提交于 2019-12-12 10:56:20
问题 I have a class which contains a List<Func<T>> . The class is serializable and will be transferred over WCF. Now, I have problems with contained List<Func<T>> . What can I do that this list will also be serializable? 回答1: How would you expect a Func<T> to be serialized? It's a pointer to a function - such a thing cannot be serialized. 来源: https://stackoverflow.com/questions/12960793/serialize-listfunct

send dynamic table or div content as an email body content

时光毁灭记忆、已成空白 提交于 2019-12-12 10:48:46
问题 I have a page ( somePage.aspx ) and I need the content that has been generated as an Email body <div id="DV_TimeReportWraper" runat="server" style="display:block"> <table id="TBL_UsersinTblTime"> <tr id="TR_UsersinTblTime"> <td id="TD_H_Name" class="Dg"> name </td> <td id="TD_H_UserID" class="Dg"> ID </td> <td id="TD_H_Status" class="Dg"> initial Stage </td> <td id="TD_H_SignOutAutoExeState" class="Dg"> current Stage </td> </tr> <% if(edata != null) for (int idx=0;idx<edata.Count;idx++) { var

LocalSqlServer was not found in the applications configuration or the connection string is empty

南楼画角 提交于 2019-12-12 10:44:58
问题 I've just upgraded a .NET 3.5 MVC 1 project to .NET 4.0 MVC 3 and for some reason now when I try to run it it says: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.` I'm not sure why it does this as no where in my code does it look for a LocalSqlServer connection string, and if I put in a LocalSqlServer connection string in my config file with the value of my standard connection string and try to go onto the website, it

Entity Framework error when submitting empty fields

社会主义新天地 提交于 2019-12-12 10:44:56
问题 VS 2010 Beta 2, .NET 4. In my ASP.NET MVC 2 application, when I submit a form to an action method that accepts an object created by the entity framework, I get the following error: Exception Details: System.Data.ConstraintException: This property cannot be set to a null value. Source Error: Line 4500: OnTextChanging(value); Line 4501: ReportPropertyChanging("Text"); Line 4502: _Text = StructuralObject.SetValidValue(value, false); Line 4503: ReportPropertyChanged("Text"); Line 4504:

Check if a webservice exists

最后都变了- 提交于 2019-12-12 10:43:57
问题 Could someone please be kind enough to show me the best way to determine if a webservice (ASP.NET) exists at a given URL? I assume an approach will be something along the lines of issuing a request using System.Net.Webclient but how could I determine if it is a valid webservice and what sort of request should I issue? EDIT: To add a bit more context I am determining if a webservice exists because I am attempting to build a generic tool that uses arbitrary webservices. 回答1: The only way IMHO

Threading in Windows Forms

家住魔仙堡 提交于 2019-12-12 10:21:20
问题 I have been writing ASP.NET web application for years now, but haven't really worked on large windows forms projects. I now need to work on one, so I am looking on some pointers on how a large windows forms project should ideally be structured. More specifically, I would like to know how to handle multiple threads. Assume you have a process which takes some time to complete - you do not want to have the ui window frozen and not responding. So that logic needs to move in a separate thread. If