Archive for the ‘C# 4.0’ Category
Posted by jpluimers on 2011/04/11
Somehow in a production environment I did get this error too:
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154.
These two posts helped me to solve it:
SharePoint 2010 beta error: Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa – SharePointWiz – Site Home – MSDN Blogs.
Rhythmic Coding: Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154.
The solution is deceptively simple:
Resolution: It is because you are trying to build a x86 application. Go to project properties and set type to x64 everywhere. Then rebuild and debug. The Error Vanishes!
The SharePoint 2010 dll’s are all x64, and Visual Studio 2010 by default still starts .NET projects in x86 mode for both Release and Debug settings.
–jeroen
Posted in .NET, .NET 4.0, C#, C# 4.0, Development, SharePoint, Software Development, Visual Studio 2010, Visual Studio and tools, Web Development | 8 Comments »
Posted by jpluimers on 2011/04/05
While browsing for some less used but useful C# features, I came across a great post by Michael (Mike) Ward from Blue Onion Software on Favorite C# Idioms based on the great Hidden Features of C# thread on StackOverflow.
Mike starts with
There’s a great post on Stackoverflow about hidden features in C#. I prefer to think of these as idioms rather than hidden features since most are actually documented. Here are my favorites.
Then he continues with some nice examples of C# idioms.
Recommended reading!
–jeroen
via Favorite C# Idioms | Blue Onion Software.
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2011/02/24
Often I explain to people that there are a lot of .NET languages, because the .NET IL is rich, so the individual languages can focus on the IL pieces they do best.
This also means, that most languages have some support for specific pieces of IL that other languages do not have support for.
The IL Exception Filter feature is one such thing. It is supported by for instance VB.NET but not by C# as Junfeng Zhang explains:
C# does not support exception filter. However, VB and IL support it. To add exception filter to C#, we can build a function in VB or IL, then call it in C#.
Read his full article for the complete code.
–jeroen
via: Exception Filter – Junfeng Zhang’s Windows Programming Notes – Site Home – MSDN Blogs.
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Development, Software Development, VB.NET | Leave a Comment »
Posted by jpluimers on 2011/02/22
Often you work with projects not having the latest stuff.
Sometimes that is a good thing: latest stuff is not always best :-)
In this case, the client had Office 2003, and needed to do some Excel automation from .NET.
The development systems however had Office 2007 on it, so importing Excel defaults to the Office 2007 Primary Interop Assembly: Office version 12 in stead of 11. Read the rest of this entry »
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Delphi, Development, Prism, Software Development, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools | Leave a Comment »
Posted by jpluimers on 2011/02/17
Recently, I wrote a bunch of code both in C# and Delphi to verify if two hosts are on the same IPv4 network.
Even though the public IPv4 address space is exhausted (IANA recently allocated the final two IPv4 blocks of their primary pool to APNIC, then allocated the five remaning /8 IPv4 blocks to the RIRs, thereby depleting the IPv4 pool), they are still used a lot, especially in private networks.
Over the next couple of weeks, you will see a couple of blog posts explaining:
- how to get the IPv4 addresses and network masks of network interfaces in your computer
- how to convert those to and from strings
- how to convert a host-name to a list of IP addresses
- how to lookup the current host-name
- how network masks are related to counting leading/trailing ones and zeros
- how to compare two IPv4 addresses given they have the same network masks
Those blog posts will have sample code in both Delphi and C#. And there will be unit tests to verify the underlying code.
–jeroen
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Delphi, Development, Software Development | 2 Comments »
Posted by jpluimers on 2011/02/10
Greg Hewgill published a bunch Stack Overflow ebooks and StackExchange stats.
His readme explains a bit more on the books.
The blog he maintains makes up for some nice reading too.
Be sure to read the blog entry on the ebooks.
–jeroen
via Stack Overflow ebooks.
Posted in *nix, .NET, ASP.NET, C#, C# 2.0, C# 3.0, C# 4.0, Database Development, Delphi, Delphi for PHP, Development, HTML, HTML5, Java, Pingback, Power User, RegEx, Scripting, SocialMedia, Software Development, SQL, SQL Server, Stackoverflow, XML/XSD | Leave a Comment »
Posted by jpluimers on 2010/09/29
Recently, a co-worker at a client asked me “What is better: extension methods of helper classses?”.
This question is relevant not only in the .NET and Delphi worlds.
My answer was simple, consisting of these 3 points: Read the rest of this entry »
Posted in .NET, C#, C# 4.0, Delphi, Development, Opinions, Software Development | 5 Comments »
Posted by jpluimers on 2010/05/21
Scott Dorman udpated his macro to change the target framework version for all projects in a solution to Visual Studio 2010 and published the new macro on CodeProject.
His new macro now supports these target frameworks:
Notes:
- The links are to the download pages of the frameworks; look for “Standalone version” or “Full installer” for non-bootstrap download.
(version 1.1 can be downloaded here, but is not supported in VS2010)
- The “Client Profile” versions are stripped down versions of their “Full” counterpart.
–jeroen
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Delphi, Development, Prism, Software Development, Visual Studio and tools | 2 Comments »
Posted by jpluimers on 2010/05/14
I always tend to recompile assemblies when something changes they depend upon.
But now I’m even more careful after reading Fabulous Adventures In Coding : Putting a base in the middle.
Especially his checklist is important.
When you use a newer version of an assembly you depend on:
(1) at the very least test your derived types with the new base type — your derived types are relying on the mechanisms of the base types; when a mechanism changes, you have to re-test the code which relies upon that mechanism.
(2) if there was a breaking change, recompile, re-test and re-ship the derived type. And
(3) you might be surprised by what is a breaking change; adding a new override can potentially be a breaking change in some rare cases.
–jeroen
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Delphi, Development, Prism, Software Development | Leave a Comment »
Posted by jpluimers on 2010/05/13
When you want to deploy WPF, it is important to check if you have sufficient hardware acceleration for your apps.
The most important things to check is the RenderCapability.
It gives you the Tier on which graphics is rendered.
The Tier tells something about hardware acceleration support, including a broad estimate of the pixel shader and vertex shader levels and DirectX versions.
Currently, there are 3 tiers: Read the rest of this entry »
Posted in .NET, C#, C# 3.0, C# 4.0, Development, Software Development, WPF | 1 Comment »