.net-4.5

Debug XBAP hosted in WPF Application

我们两清 提交于 2019-12-23 04:45:14
问题 I have a WPF Application (say, WPF.exe) with multiple tabs. In one of the tabs, I display a *.xbap using: WebBrowser tag. <WebBrowser Source="c:/PublishedWebSites/Test.xbap"/> When I start WPF.exe, I am able to attach debugger to any other UserControl but not to my XBAP. I also tried attaching my XBAP to PresentationHost.exe process which was started when I click on the browser tab. The break points are not hit in XBAP project, though I verified that when I publish the XBAP, I oublish *.pdb

How do i bind data source to a ComboBox?

帅比萌擦擦* 提交于 2019-12-23 04:34:40
问题 So i currently have two combo boxes. One Being Manufacture the other being model. My sql query looks like this "Select Distinct Model From sheet1 where (Manufacture =@Manufacture)" this works when i execute it and if i were to fill a datagridtable. But if i try to place this into a combobox i get System.data.d...... etc for my selections. How can i just have it show the values instead of all this. What am i doing wrong? private void ManuComboBox_SelectedIndexChanged(object sender, EventArgs e

Disposing of XmlReader with pending async read

ε祈祈猫儿з 提交于 2019-12-23 04:03:33
问题 I'm writing a .NET XMPP library for fun and as has been discussed elsewhere the XmlReader implementation in versions prior to .NET 4.5 was not suitable for parsing XML from a NetworkStream as it would not begin parsing until it filled an internal 4KB buffer or reached EOF. Other libraries got around this by not using XmlReader at all. As mentioned in the previously linked question, jabber-net uses a port of a Java XML parser. An implementation I found while searching, Babel IM, uses its own

How to define away code based on .NET framework version?

江枫思渺然 提交于 2019-12-22 10:45:53
问题 I have a function that would love to take advantage of the "correct" way to do something that was provided in .NET 4.5: public DbDataAdapater CreateDataAdapter(DbConnection connection) { #IFDEF (NET45) return DbProviderFactories.GetFactory(connection).CreateDataAdapter(); #ELSE //We can't construct an adapter directly //So let's run around the block 3 times, before potentially crashing DbDataAdapter adapter; if (connection is System.Data.SqlClient.SqlConnection) return new System.Data

WPF: In an attached property, how to wait until visual tree loaded properly?

非 Y 不嫁゛ 提交于 2019-12-22 09:26:04
问题 I have an Attached Property in a WPF app. The code below is inside the OnLoad event, but it doesn't work unless I add a hacky 500 millisecond delay in. Is there some way to avoid this delay, and detect when the visual tree has been loaded? private static void FrameworkElement_Loaded(object sender, RoutedEventArgs e) { // ... snip... Window window = GetParentWindow(dependencyObject); // Without this delay, changing properties does nothing. Task task = Task.Run( async () => { { // Without this

When to use LINQ's .ToList() or .ToArray()

别说谁变了你拦得住时间么 提交于 2019-12-22 02:32:14
问题 After running this code: var input = new List<T>( ... ); var result = input.Select( t => new U(t) ); U first1 = null; foreach ( U u1 in result ) if ( first1 == null ) first1 = u1; U first2 = null; foreach ( U u2 in result ) if ( first2 == null ) first2 = u2; Then 'first1 == first2' evaluates to false even though both U's wrap the same T. I haven't tested it yet, but I think it can be made to evaluate to true by chaining a .ToList() or .ToArray() onto the Select() call. In real code, which is

Why does TextBlock trims ending spaces from the text?

我只是一个虾纸丫 提交于 2019-12-22 02:00:03
问题 Here is my TextBlock s <StackPanel Orientation="Horizontal" Margin="0,3,0,0"> <TextBlock Text="6 or more characters, at least one letter and a number, " FontFamily="Segoe UI" Foreground="#000000" FontSize="13"/> <TextBlock Text="no symbols" FontFamily="Segoe UI" Foreground="#000000" FontSize="13"/> </StackPanel> And here is the output (screen shot) Why TextBlock trims ending spaces? However it works fine when I give leading spaces. 回答1: It looks like xml:space="preserve" should do the trick

.NET 4.5: internal error in the .NET Runtime (80131506) / disabling concurrent GC

一世执手 提交于 2019-12-22 01:33:25
问题 I have a long-running .NET 4.5 application that crashes randomly, leaving the message I've mentioned in the question title in the event log. The issue is reproduced on 3 different machines and 2 different systems (2008 R2 and 2012). Application doesn't use any unsafe/unmanaged components, it's pure managed .NET, with the only unmanaged thing being the CLR itself. Here's the stack trace of the crash site that I've extracted from the dump: clr.dll!MethodTable::GetCanonicalMethodTable() clr.dll

HttpContext does not work in global.asax.cs

試著忘記壹切 提交于 2019-12-21 23:06:38
问题 I have this code in the global.asax.cs protected void Application_Start(object sender, EventArgs e) { string logFile = HttpContext.Current.Request.PhysicalApplicationPath + "log4net.config"; } It works fine in .NET 4.0, but throws the following exception when using in .NET 4.5. Request is not available in this context 回答1: Error seems pretty clear - the Request object is not available in that event. Try HttpRuntime.AppDomainAppPath or Server.MapPath(".") instead. 回答2: The answer is quite

Edmx file with Visual Studio 11 Beta .Net 4.5

自古美人都是妖i 提交于 2019-12-21 21:26:36
问题 I am having trouble creating a new edmx file using Visual Studio 2011 beta Target framework .Net 4.5 Class library project After adding an empty model I get the error below Error 6039: warning CS1701: Assuming assembly reference 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' matches 'System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', you may need to supply runtime policy \fjwflppr.0.cs(465,29) : error CS1061: