.net-4.0

Only while running on VS 2010: COMException: Catastrophic Failure: Error Code: -2147418113

匆匆过客 提交于 2019-12-24 01:16:24
问题 I am stuck with this error: while trying to use an old DLL in .Net Framework 4.0 If I change project target type to 3.5 then no error appears. The strange is that all this happen Only while running inside VS 2010. If I run the executable from Windows Explorer, no problem occurs in 3.5 and 4.0. Seems like some bug in vshost? VS 2010 Express, or .net framework? UPDATE: This BUG only happen on WPF Standalone Application, if a change it to XBAP WPF I can use the dll without bigger problems, only

query a list of dynamic objects

独自空忆成欢 提交于 2019-12-24 01:04:14
问题 I am using massive to get the config table in the database. I would like to cache the config since the app gets values from it all the time. once cached is there an easy way to find the object where name = 'something' here is where the whole table is cached. protected override dynamic Get() { var ret = HttpRuntime.Cache["Config"]; if (ret == null) { ret = _table.All(); HttpRuntime.Cache.Add("Config", ret, null, DateTime.Now.AddMinutes(2), Cache.NoSlidingExpiration,CacheItemPriority.Low, null

Debugging mscorlib in .Net 4.0

不问归期 提交于 2019-12-24 00:55:57
问题 I'm getting the following exception from System.IO.Path.CheckInvalidPathChars() in mscorlib: [ArgumentException: Illegal characters in path.] System.IO.Path.CheckInvalidPathChars(String path) +142 System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength) +100 System.IO.Path.GetFullPath(String path) +187 System.Xml.XmlResolver.ResolveUri(Uri baseUri, String relativeUri) +114 System.Xml.XmlTextReaderImpl..ctor(String url, XmlNameTable nt) +135 System.Xml.XmlDocument.Load

System.Data.SQLite.DLL no longer loads after switching target framework

只谈情不闲聊 提交于 2019-12-24 00:51:21
问题 I had to switch from .net 4.5 to .net 4.0 because some of my customers still use WinXP. Now, after switching, this is the error I'm getting: Could not load file or assembly 'System.Data.SQLite, Version=1.0.66.0, Culturre-neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format. I haven't been able to find a solution for this, but here's what I tried so far: Switch back to 4.5 - Didn't work Add the reference again -

Cannot use Color.FromArgb in DataGridView cell BackColor

早过忘川 提交于 2019-12-23 23:08:50
问题 I am looping through a DataGridView control and adding rows dynamically. I am setting the BackColor property of each cell based on the following logic: if (bidVolume != null) { this.Rows[this.RowCount - 1].Cells[1].Style.BackColor = Color.Green; } else { this.Rows[this.RowCount - 1].Cells[1].Style.BackColor = Color.FromArgb(150, Color.Green); } This is causing problems, the color is not properly set visually and when re-sizing the DataGridView it looks like this: When I don't use Color

How to stop the execution of UC at page load on Visible false

孤街浪徒 提交于 2019-12-23 19:12:12
问题 I am thinking to stop the execution of pageload if that UC has been set to Visible false at the container page. Right now I am upto the following logic public class TestControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (this.Visible) { //do heavy operation } } } i.e I will check whether the control is visible false or not in the Page load of UC, if true, then only do the operations there. Is there any other better way to do so? I have so many UC

Using reflection to get property attributes from a metadata class

血红的双手。 提交于 2019-12-23 19:09:32
问题 I have a LINQ generated class called Project. I wanted to add some attributes to the generated properties, so I defined a partial class with the MetadataType attribute. [MetadataType(typeof(Project_HiddenProps))] public partial class Project : IProject { // There are also a few additional properties defined here. } public class Project_HiddenProps { [HiddenColumn] public System.Guid Id { get; set; } // Id is an auto-generated property that I've added a custom attribute to } Later, I use

MSBuild command line execution of Visual Studio 2010 Solution fails referencing VS2010 SDK to build an extension

微笑、不失礼 提交于 2019-12-23 18:11:17
问题 Scenario Solution that has a VS2010 extension in it (.NET 4 Class library, with a WPF UI) It builds fine inside visual studio On the same machine when I attempt to build it via command line (as part of a build script) Fails when using this command to attempt to build it: msbuild JsExt.sln /t:Build /p:Configuration=Debug /p:OutDir=..\..\Binaries Update To MSBuild Adding /property:VsSDKInstall="C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK" leads to this exception...

How to detect internally whether the application is in console or windows mode in C#

余生长醉 提交于 2019-12-23 17:42:31
问题 Is there a way to check whether a program is in console or windows mode from within the application itself? I know that Read and ReadLine can somehow detect this, but how? 回答1: You should be able to check to see if Console.In == StreamReader.Null; If this is true, there is no console attached. For example, the following works properly for this: public static bool IsConsoleApplication { get { return Console.In != StreamReader.Null; } } 来源: https://stackoverflow.com/questions/10957440/how-to

WPF C# implementing a resize grip

谁说胖子不能爱 提交于 2019-12-23 17:27:44
问题 i want to implement a resize grip to my tool. I know that i can activate a grip by setting ResizeMode="CanResizeWithGrip" but i want to grip to be in an Grid, which is only visible on Hovering. I made a Grid with an Image <Grid x:Name="gridResize" Background="Transparent" Margin="236,235,0,0"> <Image x:Name="resizeGrip" HorizontalAlignment="Left" Height="30" VerticalAlignment="Top" Width="27" Margin="37,35,0,0" Source="UserControls/Images/sizegrip.png"/> </Grid> And i have to handle these