Archive

Posts Tagged ‘.net framework’

Visual Studio 2010 & Resharper 5 hit the interwebs.

April 13th, 2010 No comments

A little late on this one, but MSFT have released the long awaited Visual Studio 2010 release and JetBrains have also released ReSharper 5.

A full breakdown of Visual Studios are also available, not a huge fan of all these different SKUs to be honest. You can download a copy from your MSDN subscriptions now, or download the trial version (direct download), buy an upgrade from VS2008 or just download the .NET 4.0 runtime (48Mb).

I’ve spent the past 3 hours downloading from MSDN and its been crawling.

MUST.HAVE.PLINQ.FIX.

{lang: 'en-GB'}
Share

Some changes in .NET BCL 4.0

November 21st, 2009 1 comment

I’ve been porting a few products to .NET 4.0 and came across some cool new additions in .NET 4.0 which will be quite useful for developers.

Strings

Streams

Remember writing this before to copy one stream to another?

public static void CopyTo(this Stream input, Stream output)
{
byte[] buffer = new byte[2048];
while (true)
{
int read = input.Read (buffer, 0, buffer.Length);
if (read <= 0)
return;
output.Write (buffer, 0, read);
}
}

Now you don’t need to, just use the Stream.CopyTo() method.

inputStream.CopyTo(output);

Checking for 64bit-ness

Previously to detect a 64bit operating system you would either P/Invoke out and call the IsWow64Process in Kernel32, looked at the “PROCESSOR_ARCHITECTURE” environment variable or even easier (and completely managed code) way of checking the size of a Pointer.

public static bool IsWin64
{
return (IntPtr.Size == 8);
}
public static bool IsWin32
{
return (IntPtr.Size == 4);
}

Now you can simply use the Environment class that comes with two new properties.

WPF 4.0 Improvements

There are simply too many to list, see the article on ScottGu‘s blog about WPF4 and VS2010/.NET 4.0.

One very important tweak are the Text Rendering improvements that TextBlock‘s now have a new TextOptions.TextFormattingMode that greatly improves the quality of text rendering.

<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<StackPanel xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
<TextBox TextOptions.TextFormattingMode="Ideal" FontSize="11">ThushanFernando.com - Ideal</TextBox>
<TextBox TextOptions.TextFormattingMode="Display" FontSize="11">ThushanFernando.com - Display</TextBox>
<TextBox TextOptions.TextFormattingMode="Ideal" FontSize="16">ThushanFernando.com - Ideal</TextBox>
<TextBox TextOptions.TextFormattingMode="Display" FontSize="16">ThushanFernando.com - Display</TextBox>
</StackPanel>
</Grid>
</Window>

Here’s a pretty picture showing the difference between using Ideal and Display. The difference is noticable for text sizes below 15.

MainWindowAlternatively you can place it in the Window so all child controls will render nicely.

<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow - Display" Height="350" Width="525"
TextOptions.TextFormattingMode="Display">
<Grid>
<StackPanel xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
<TextBox FontSize="11">ThushanFernando.com</TextBox>
<TextBox FontSize="16">ThushanFernando.com</TextBox>
</StackPanel>
</Grid>
</Window>

There are LOTS more coming in .NET 4.0 that will make anyone doing .NET development today just wet their pants over, just read the article on MSDN by Justin Van Patten about Whats new in the BCL in .NET 4.0 and also posted on the BCL team blog.

{lang: 'en-GB'}
Share

Hot Booty: Visual Studio 2010 Beta Launches!

May 19th, 2009 No comments

Quick note from Somasegars blog that Visual Studio 2010 Beta 1 along with .NET Framework 4.0 Beta 1 is shipping. Take a look at the Visual Studio 2010 Home Page for more information or if you have MSDN grab it from your subscriber downloads.


{lang: 'en-GB'}
Share

.NET Framework 3.5 SP1 CLR Improvements

August 20th, 2008 No comments

Kevin Frie, the lead developer for core bits of the CLR just posted some information about the changes in .NET CLR 3.5 SP1. Heres an excerpt:

NGen infrastructure rewrite: the new infrastructure uses less memory, produces less fragmented NGen images with much better locality, and does so in dramatically less time.  What this means to you:  Installing or servicing an NGen image is much faster, and cold startup time of your NGen’ed code is better.

Framework Startup Performance Improvements: The framework is now better optimized for startup.  We’ve tweaked the framework to consider more scenarios for startup, and now layout both code & data in the framework’s NGen images more optimally.  What this means to you:  Even your JIT code starts faster!

Better OS citizenship: We’ve modified NGen to produce images that are ASLR capable, in an effort to decrease potential security attack surface area.  We’ve also started generating stacks that are always walkable using EBP-chaining for x86.  What this means to you:  Stack traces are more consistent, and NGen images aren’t as easily used to attack the system.

Better 32-bit code quality: The x86 JIT has dramatically improved inlining heuristics that result in generally better code quality, and, in particular, much lower “cost of abstraction”.  If you want to author a data type that only manipulates a single integer, you can wrap the thing in a struct, and expect similar performance to code that explicitly uses an integer.  There have also been some improvements to the ‘assertion propagation’ portion of the JIT, which means better null/range check elimination, as well as better constant propagation, and slight better ‘smarts’ in the JIT optimizer, overall.  What this means to you:  Your managed code should run slightly faster (and sometimes dramatically faster!).  Note to 64 bit junkies:  We’re working on getting x64 there, too.  The work just wasn’t quite there in time.

Whats interesting to note is that the CLR Optimisations for inlining will finally be coming to the 64bit CLR, just hope that it comes sometime sooner rather than later.

In the meantime, grab the .NET Framework 3.5 SP1.

{lang: 'en-GB'}
Share