Below you will find pages that utilize the taxonomy term “dotnet”
Blog
Using (Table Storage) Bindings in Azure Functions
My post Using Triggers & Bindings in Azure Functions V2 drew quite some attention over the past months. But there is a lot more to say about them. Time for a small follow up 😁
Covered previously ⌚ In my previous post we covered relative simple things like writing to blob storage and putting messages on a Service Bus. But the bindings for Azure Functions are so much more powerful.
Blog
Azure App Configuration with .NET Full Framework
This post on using App Configuration using .NET Full Framework was based on a contribution by Steven Hack.
My last post Azure App Configuration: an introduction received a lot of good feedback. And one of those pieces of feedback was a question if it’s also possible to use App Configuration if you’re using Full Framework.
The short answer: yes, this is possible!
For the slightly longer answer: keep reading 🤓
Blog
Azure App Configuration: an introduction
Azure App Configuration is a powerful way to manage and store application configuration on a central location. Integrating it into for instance ASP.NET (Core) is pretty straightforward. This post gives you an introduction to Azure App Configuration and a simple example of how to integrate it in ASP.NET Core.
Creating an Azure App Configuration 🆕 Of course there are several ways to create a specific resource in the Azure Portal. One of the simplest is to go to the portal, open up App Configuration and click the Add button.
Blog
Creating a custom JsonNamingPolicy
Probably there’s no need for me to say why .NET Core 3.0 is a big deal. There are enough articles on that. For a great write-up see Announcing .NET Core 3.0.
From the inception of the .NET Core project, we’ve added around fifty thousand .NET Framework APIs to the platform. .NET Core 3.0 closes much of the remaining capability gap with .NET Framework 4.8.
Introducing .NET 5
Next to adding this massive amount of .
Blog
Front Door incomplete first request
Yesterday I was working with one of our customers to fix an issue with an ASP.NET application throwing an error. That application threw the error on the first request coming in through Azure Front Door. When we sent a request to the original (back end) URL, the application worked fine and never threw the exception. 🤔
Time to investigate…!
Finding the cause 🧐 First step of course was to find the cause of the exception.
Blog
Managed Identity – Part III
This post is part of a series on Managed Identity. For an introduction, see Managed Identity – Part I. For a post that shows you how to connect your application to different types of Azure resources using Managed Identity see Managed Identity – Part II. Stay tuned for future posts.
Introduction Elaborating on Part I and Part II, this blog post will show you how to debug your Managed Identity enabled application locally.
Blog
Video content 📹
Some time ago Oscar van Tol and I started creating video content for the community. We call them #Betatalks and create them because of two very important reasons:
We believe in sharing knowledge It’s. So. Much. Fun. 🤣 We talk about a lot of developer stuff: from “Microsoft Build 2019 Highlights” in episode 1 to “C# 8, What’s new?” in episode 4.
The most recent #Betatalks is episode 5: “All about configuration in Azure”.
Blog
Managed Identity – Part II
This post is part of a series on Managed Identity. For an introduction, see Managed Identity – Part I. Stay tuned for future posts.
Introduction Elaborating on Part I, this blog post will show you how to connect your application to different types of Azure resources using Managed Identity.
To use the Managed Identity to actually connect to Azure Resources, you’re going to need the NuGet package Microsoft.Azure.Services.AppAuthentication. This package enables a service to authenticate to Azure services using the developer’s Azure Active Directory/ Microsoft account during development, and authenticate as itself (using OAuth 2.
Blog
Managed Identity – Part I
This post is part of a series on Managed Identity. Stay tuned for future posts.
Introduction Connecting your application to a resource like Storage or a SQL database used to involve a connection string. This isn’t very secure. These settings are available through the Azure portal. So they might get compromised.
With the introduction of Azure Key Vault, we got a way of separating these secrets from our application configuration. We can store them in a safe, secure place.
Blog
Dynamic output bindings in Azure Functions
Last week one of my colleagues had a question: Is there a performance penalty when you add multiple Azure Blob storage bindings in an Azure Function? Or is the connection only established when you access one of those blobs? Answering this grew into a way to have Dynamic output bindings in Azure Functions.
This post elaborates on [blog/using-triggers-bindings-in-azure-functions-v2](Using Triggers & Bindings in Azure Functions V2).
First try The idea was simple:
Blog
Dutch VS2019 launch event
We’re hosting a VS2019 Launch Event at the Betabit The Hague office. Join us for some Visual Studio 2019 goodness! And maybe even some swag… ?
Join us on April 2 for the launch of Visual Studio 2019. Learn about how Visual Studio 2019 is more productive, modern, and innovative, participate in live Q&As, and be the first to take the latest version for a spin.
https://visualstudio.microsoft.com/vs2019-launch/
The agenda is as follows:
Blog
Using Triggers & Bindings in Azure Functions V2
To start things off: yes. There’s some pretty decent documentation on all the available Triggers & Bindings in Azure Functions. Like this overview page. And you can also find documentation on specific bindings, like the Service Bus Binding. Nevertheless, I wanted to add to that documentation with some simple, real-world examples using triggers & bindings. So here goes.
Writing to Blob Storage Consider this very simple BlobTriggered Azure Function. It copies the triggering file into a different container in Azure Blob Storage:
Blog
So many new (.NET) goodies!
The people over at Microsoft have been working hard and have delivered a lot of stuff. That makes for a nice start after the holidays! So there’s a lot of cool stuff available to play with. I created some simple and easy to remember links for all of these goodies. Feel free to use and distribute these 🙂
Links to the goodies! The spec for .NET Standard 2.0 is complete (https://bit.
Blog
.NET Core: not your daddy’s dotnet
We held a 2.5 hour presentation about .NET Core at the Betabit office in Rotterdam on March 29th. Where ‘we’ means my colleague Oscar van Tol and myself. We ended up having way too much content for the evening. We decided to host a hands-on workshop for those interested. At that workshop we will not only show .NET Core, but also enable you to have a go at it yourself. The location will most probably be the Betabit office in Utrecht because it’s located more central.
Blog
Running Visual Studio as an administrator causes ‘Save changes to devenv.sln’ when double clicking solutions
After making sure my Visual Studio always ran as an administrator by following my own post HowTo: Have Visual Studio always run as administrator on Windows 8, I got a message if I wanted to save changes to devenv.sln each and every time I double clicked a Solution. Since the problem kept occuring after installing Visual Studio 2015 CTP6, I wanted to solve it. So here we go!
Double clicking a Solution file doesn’t start devenv.
Blog
Error: The Path ‘path’ is already mapped in workspace ‘workspace’
Just a quick little post today: I got the error “The Path ‘path’ is already mapped in workspace ‘workspace’” when I connected to a new Team Foundation Server and tried to map my workspace today. I had connected to a Team Foundation Services project a while back to get some shared code, but I already removed the workspace and the server binding. Even though Visual Studio didn’t see any other bindings, mapping my workspace to the same folder the previous TFS binding was mapped to served me this error.
Blog
How to add Next and Previous buttons to Twitter Bootstrap tabs
Just a quickie today: when working with Twitter Bootstrap tabs, like I am in my ASP.NET MVC 4 project, you might want to add Next and Previous buttons on the tabs to create something of a Wizard. Here’sa step by step overview of how I did this:
Add an ID to all the ListItem elements that are used for the tab navigation. For instance:
<ul class="nav nav-tabs" id="myTab"> <li><a href="#example" data-toggle="tab" id="xmpl">Example</a></li> .
Blog
Debugging JavaScript with Visual Studio in an ASP.NET MVC 4 application
When debugging JavaScript in an ASP.NET MVC (4) application, it is not always enough to uncheck the ‘Disable script debugging’ checkboxes under ‘Tools’ – ‘Internet Options’ – ‘Advanced’ – ‘Browsing’. JavaScript inside a Razor view (a cshtml file) cannot be debugged from Visual Studio. To debug your JavaScript, move it to a separate .js file and link to that file from your Razor view. This way, breakpoints set in the JavaScript will be hit and you can debug from Visual Studio.
Blog
How To: Call a generic method with a runtime type
Problem:
Developing a generic class that maps datasets, datatables and datarows from a legacy system to my domain model, I ran into an issue. I wanted to call a generic method with a runtime type. Lets say the method looked like this: public string DoSomething<T>(string param). Because I use reflection to iterate properties on a type, the type of the properties was dynamic and only known at runtime. I wanted to do something like this:
Blog
How To: Create an ActionLink with a Twitter Bootstrap icon in MVC4
Twitter Bootstrap is a… “Sleek, intuitive, and powerful front-end framework for faster and easier web development.” One of the nice things in Bootstrap is you can use icons from Glyphicons. To use these, you can simply use this markup <i class="icon-fire"></i> to get a nice fire icon.
Translating this into an ActionLink styled as a button in an MVC4 application would look something like the following:
@Html.ActionLink("<i class="icon-fire"></i> Invent fire", "fire", new { @class = "btn" }) Unfortunately, this renders as follows:
Blog
TIP: “Paste XML as Classes” in Visual Studio 2012
In the past, when you had some XML document that you wanted to translate into classes we had to create / generate a schema based on the XML file. Next, we had to generate a class based on the schema with an external tool. Not all too user friendly and somewhat time consuming.
In Visual Studio 2012 you copy the XML you want to create a class/classes for, place the cursor in a class file on the location you want the code to be added and select the following menu items: Edit – Paste Special – Paste XML as Classes.
Blog
Unable to access the IIS metabase
I opened a solution in Visual Studio 2012 on my laptop running Windows 8, when I was presented with the error “The Web Application Project SomeWebProject is configured to use IIS. Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.” The user I was logged in with was a local administrator and was able to open up and use IIS Manager, but still I was presented with this error.
Blog
Ajax Control Toolkit Calendar doesn’t close when clicking outside the calendar
Just a quick one: if you have a textbox with a Calendar (extender) from the Ajax Control Toolkit and an associated PopupButtonID which is an image, the calendar won’t close when you click outside the popup. Use an input type=”image”or an ImageButton to solve this problem.
Hope this helps.
Blog
Documents.Open returns null, running Word automation under ASP.NET on x64
When building an ASP application that generates Word documents, it was working fine on the local machine: A Windows XP installation with Office 2007. When we deployed it to windows 2008 (64 bit) and Word 2007 we saw that Documents.Open returned null. Other than this, there are no exceptions.
The code that returned the error (simplified):
Application app = new Application(); Document doc = app.Documents.Open(ref name); As it turns out, a 64 bit system stores temporary files in C:\Windows\Sys\WOW64\config\system\profile\Desktop folder.
Blog
Unhandled exception installing SQL Server 2008 R2 on a Windows XP / Windows 7 machine
When installing SQL Server 2008 R2 on a Windows XP (or, according to the comments, Windows 7) development machine that has been around for quite some time, I got an error stating an unhandled exception occured in the application (see image). The error showed up directly upon startup and read:
An error occurred creating the configuration section handler for userSettings/Microsoft.SqlServer.Configuration.LandingPage.Properties.Settings: Could not load file or assembly ‘System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ or one of its dependencies.
Blog
Error installing the Windows Azure AppFabric Tools for Visual Studio (CTP)
When installing the Windows Azure AppFabric Tools for Visual Studio (found here), you might get the error message shown at the top, stating that Windows Server AppFabric is installed and that it is not compatible with this release of Windows Azure AppFabric Developer Tools for Microsoft Visual Studio 2010 – June 2011 CTP. It asks to uninstall Windows Server AppFabric and rerun this setup if you want to install Windows Azure AppFabric Developer Tools for Microsoft Visual Studio 2010 – June 2011 CTP.
Blog
The Visual Studio 2010 Test Client for WCF services
When writing WCF services, most of us find ourselves writing quick test applications. To give you more time to do what a developer should be doing (adding business value to the project) the Visual Studio team added a WCF test client that can help you reach goals faster.
This is not a very difficult application, but it does the trick and is more than sufficient for simple testing. The WCF Test Client can be found at this location (without the ‘ (x86)’ for x86 machines): C:\Program Files (x86)\Microsoft\Visual Studio 10.
Blog
HowTo: Save a file from Silverlight using the SaveFileDialog
Saving a file from Silverlight using the SaveFileDialog, added in Silverlight 3, is easy. If you’re used to desktop development however, you might find yourself getting a SecurityException with the message ‘File operation not permitted. Access to path ‘xxx’ is denied.’. Here’s why:
In desktop development, you’re used to getting a filename from a SaveFileDialog. Next, you start doing whatever you need to be doing to the file, based on the filename.
Blog
‘Cannot find entry to delete’ deleting files from a Zip with (SL) SharpZipLib
For a project I’ll probably dedicate a post on this blog to in the future, I needed a ZIP library for Silverlight. After asking around on twitter (@rickvdbosch) I was pointed towards the SharpZipLib port on Codeplex, found on https://slsharpziplib.codeplex.com.
Basically what I wanted to do was replace a file inside the ZIP file with my version of that file. The file was located in a specific folder inside the ZIP and could be found by either iterating through the ZipEntries in the ZIP, or by getting it based on its name.
Blog
Using Crystal Reports in ASP.NET on a 64 bit machine
The above scenario gave me the well-known could not load file or assembly error message. The assembly that couldn’t be found was log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304. Or one of its dependencies of course… The situation in which I was getting this error message:
using the CrystalReportViewer in an ASP.NET application having the ASP.NET application hosted in IIS (the error did not occur on the ASP.NET Development Server) running on a 64 bit machine Log4net was available in the GAC, with the exact version and PublicKeyToken stated in the error message.
Blog
Little-heard-of ASP.NET feature: app_offline.htm
Although the feature has been around since ASP.NET 2.0, I still meet people that don’t know and/or use app_offline.htm. Do you know (and use) the feature…?
When working on an ASP.NET web application, you should notify your visitors in a decent way that your application is down. There’s a nice default feature available for these purposes since ASP.NET 2.0. Somehow, however, this feature is not very well known and rarely used.
Blog
“AjaxControlToolkit is undefined”
Because we were still using an old Visual Studio 2005 solution which included a Web Site project, it was time to upgrade. We upgraded our Visual Studio 2005 solution to Visual Studio 2010 (and .NET 4.0), converted the Web Site Project to a Web Application Project and then, of course, the AjaxControlToolkit had to follow. I downloaded the latest build from their Codeplex site and updated the references in the different projects.
Blog
“The project location is not trusted”
After installing Windows 7 and Visual Studio 2010 on my laptop, I ran into the well-known message “The project location is not trusted”. I thought all I had to do was follow the instructions in this MSDN article to get my development share to be trusted again, but this doesn’t seem to work.
I already tried adding the new child group under the Internet_Zone in stead of the LocalIntranet_Zone, and using the complete server name and the server IP address in stead of the name of the server.
Blog
Fix available for IE8 asp:menu problem
I just read an interesting article on Bertrand Le Roy’s blog. The most important information:
It so happens that the menu control is making a bad assumption on what the default value for z-index should be. We debated this at length with the IE team, but it became clear as we did so that they were right and that we were wrong. We had to fix that.
So here it is, the patch for menu is out and you can apply it to build IE8-compatible ASP.
Blog
In this mode, command line arguments will not be passed to the executable
When trying to pass some command line arguments to a Console Application, I got the following message: “The current project settings specify that the project will be debugged with specific security permissions. In this mode, command line arguments will not be passed to the executable. Do you want to continue debugging anyway?” (see image)
I didn’t run in to this earlier, but yesterday it suddenly popped up. But I did change my zone security, so that might be of some influence… Apparently, this is because of the Debug in Zone settings you can find at the Security tab of your project properties.
Blog
HowTo: Add a body onload script to a page that uses a MasterPage
When you use a MasterPage to define the design of your website, you might come across the problem that there is no body element in a web content form. This can be a problem when you want to add an onload script to a specific page. You could of course add the onload on the MasterPage, but you might not want the script to run on every page. There are several workarounds to fix this ‘problem’.
Blog
Nice new addition to ASP.NET
Scott Guthrie posted about a cool new ASP.NET server control: Chart. It can be used for free with ASP.NET 3.5 to enable rich browser-based charting scenarios.
Read more over here: https://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx
Blog
Inline wrappers & Response.Redirect() == Error
While developing a page that was to be used through an inline wrapper, I got an error: “Validation of viewstate MAC failed”. This error can usually be resolved by disabling event validation, viewstate encryptionor viewstate for the MAC. In my case these solutions did not resolve the issue.
After some testing Response.Redirect appeared to be the cause. I changed the page so it doesn’t need the redirect any more, and the problem disappeared.
Blog
An inline wrapper and having too much on your head
We developed an ASP.NET page (A) to be wrapped in an existing PHP page (B) using an inline wrapper. After a few days in which both pages displayed nicely, our page (A) suddenly got displayed twice inside the existing page (B). And even weirder was that the postbacks of the first occurrence didn’t work, and the postbacks of the second were executed outside of the wrapper.
We had changed some stuff the night before, so I finally checked the file line by line against an earlier version.
Blog
StyleCop v4.3 now available
StyleCop version 4.3 was released last tuesday. A short summary of what version 4.3 brings us: Various bugfixes, including fixes for VS integration issues Rules documentation is included and integrated into VS “Show Error Help” New rules, see blogpostfor the rules Branding change from Source Analysis to StyleCop **Links
** StyleCop blog: https://blogs.msdn.com/sourceanalysis/
Release announcement on the StyleCop blog: https://blogs.msdn.com/sourceanalysis/archive/2008/08/19/stylecop-4-3-is-released.aspx
StyleCop 4.3 download: https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sourceanalysis&ReleaseId=1425
Blog
Running code analysis on a custom stsadm command gives errors CA0052 and CA0055
When you want to implement a custom stsadm for SharePoint, all you realy have to do is implement the Microsoft.SharePoint.StsAdmin.ISPStsadmCommand interface. Because I develop on a machine with no SharePoint installed, I (only) copy the assemblies I need to develop locally. For the stsadm command I was working on recently (more on this in a future post) I only needed the Microsoft.SharePoint and Microsoft.Office.Server assemblies. Or at least I thought so…
Blog
A not so clear Visual Studio code analysis message (CA1308)
While writing a custom stsadm command for SharePoint (more on that in a future post) and having to do something based on the command the user typed in, I used ToLower(CultureInfo.InvariantCulture) on the command string to be able to check without the hassle of differences in casing. When I ran code analysis on my project, I got this somewhat cryptic message:
CA1308 : Microsoft.Globalization : In method ‘CommandParser.Run(string, StringDictionary, out string)’, replace the call to ‘string.
Blog
The absolute minimum every software developer …
One of the posts that is being read quite frequently over here is HOWTO: Encode a password using MD5 in C# (or: howto calculate the MD5 hash for a string). One of the (many) reactions to that post was from one Simucal, stating:
Also, to the original poster, Rick van den Bosch… shame on you for using ASCIIEncoding.Default.GetBytes(). You do realize that would seriously restrict the usefulness of your method to working only in languages that ASCII has the character sets for, right?
Blog
A scenario where LINQ is too dynamic (answered)
The situation I talked about in my previous posthad one very big issue: LINQ sometimes just is too dynamic… 😉
The fact that I changed the value for the Ranking property for each SpecificObject that got matched, made the primary LINQ query have a different outcome. LINQ uses lazy evaluation and because of that, the contents of finalGroups and exitGroups changed every time I changed the Ranking value for one of the SpecificObjects.
Blog
A scenario where LINQ is too dynamic
While developing an algorithm to match preferences to possibilities, I had to sort a generic list of a specific object type (SpecificObject). The first x objects would be matched, the rest would be excluded because of the number of available places. To determine the group of objects that would be matched and the group that would be excluded, I did something like this:
IEnumerablesortedObjects;IEnumerablefinalObjects; IEnumerableexitObjects; sortedObjects = from SpecificObject specificObject in AllSpecificObjectsorderby specificObject.
Blog
Unable to connect publishing custom string handler …
After developing a custom Web Service to be hosted in SharePoint (based on this HowTo article on MSDN) and deploying it on a testing environment, I got some entries in the EventLog over there, stating:
“Unable to connect publishing custom string handler for output caching. IIS Instance Id is ‘xxxxxxxxx’, url is ‘https://internalsharepointserver/somesubfolder/services.asmx“
The PublishingHttpModule trying to cache an unmanaged path seems to be the problem here. When enabled for a custom web application (such as my web service), it causes the eventlog entry each time certain requests like web service calls or static CSS files are made.
Blog
The number of fractional digits is out of range?
After extending a textbox with a NumberUpDownExtender, which comes with the AJAX Control Toolkit, I recieved the error “the number of fractional digits is out of range”. This happened when debugging my web application and using the extender. When using the web app in non-debug mode, nothing happened. This included the value change ’not happening'.
Fortunately, this one was REALY easy, but it is not to be found on the web.
Blog
Error connecting to undo manager
While developing a web application for a friend of mine, I ran into a Visual Studio error message I hadn’t seen before: Error connecting to undo manager of source file ‘D:DevelopmentSomeWeb ApplicationDefault.master.designer.cs’.
The error occured whenever I tried to start the (web) application in debug mode. The application did start OK after the error message though. Starting the application without debugging didn’t cause the error.
I closed the solution file I had opened, but that didn’t solve the issue.
Blog
Rick van den Bosch .net – part II
It’s been a while because I’ve been so busy lately, but the next (technical) step for my personal website is now online. When browsing to https://rickvandenbosch.net/blog/, the content of my blog here is displayed sort of mirrored over there. I used an OpenSource RSS component to read my private rss feed from blogging about, and display it from there.
There’s still a lot of work to be done (like styling!), but I’ll get there.
Blog
Selecting all the controls of a specific type, the (built in!) LINQ way
We probably all worked with dynamically generated controls on forms, ASP.NET pages or (user) controls. And I guess we’ve all written for-each statements to loop through the ControlCollection and filter out all the controls of a specific type, right? I wanted to do the same today, so I started by trying to use LINQ for this:
This, as you can see, generated a compile time error:
Could not find an implementation of the query pattern for source type ‘System.
Blog
‘EntLib Extensions To WSSF’ released to CodePlex
Some of my (Dutch!) Avanade colleagues recently released ‘Entlib Extensions To WSSF’ to CodePlex. Quite a cool addition to the already rich Enterprise Library.
Entlib Extensions to WSSF (Web Service Software Factory) is an extension that enables WSSF to easily integrate with Enterprise Library. This extension allows you to very easily handle cross cutting concerns in WCF services like Validation, Exception Handling and Logging without much programming. The extension accomplishes this by using the policy injection application block of enterprise library.
Blog
LinkButton inside UpdatePanel results in full postback, UpdatePanel not triggered
When you dynamically generate a LinkButton in code that will be placed inside an UpdatePanel, you’ll experience that the Click event for the LinkButton results in a full postback in stead of the UpdatePanel being triggered. There’s a rather simpel solution to this problem…
First, let’s take a look at the scenario. Consider this HTML:
There’s a literal control outside of the UpdatePanel. There’s a second literal control inside the UpdatePanel.
Blog
Error adding an OleDb Data Connection to Visual Studio Server Explorer
The error I’m getting when setting up an OleDB connection to an Access database* via the Server Explorer in Visual Studio 2008 is ‘Format of the initialization string does not conform to specification starting at index 0’. The screen doesn’t display the way it should be displayed, as you can see in the screenshot on the left.
There is a possible fix at svenM’s blog(it’s about checking the existence of a key in the registry called ‘ProgID’ and the default value, as you can read in this article), but this doesn’t seem to work for my situation.
Blog
DropDownList SelectedIndexChanged doesn’t trigger UpdatePanel in SharePoint 2007 SP1
A week ago I had a nice page that was hosted in SharePoint and, among others, contained an updatepanel with a dropdownlist in it. Everything worked, and all was well. Because our testers had found some issues we had delivered two newer versions to our development environment. In the last version they found an issue that wasn’t there before: selecting a different value in the dropdown did not only update the updatepanel, but resulted in a complete postback.
Blog
Getting the ModalPopupExtender to work in SharePoint 2007
Getting the ModalPopupExtender from the Ajax Control Toolkit to work (decently) in SharePoint was not exactly a walk in the park. With a default SharePoint installation, the modal popup is partly positioned ‘outside’ of the page (you only see the bottom right part of the popup in the top left corner of the browser). Postbacks are not executed or executed poorly and the page gets garbled up. A possible solution for the positioning of the popup is to set the X and Y property of the ModalPopupExtender.
Blog
I8 converter – Download (sourcecode available)
One of my colleagues pointed out the new Fine-grained password policy feature in Windows Server 2008. As you can see in this postat The Sean Blog, some values have to be entered in the I8 format, which isn’t very user friendly. Because of that, he asked me if I could whip up a tool that converts days, hours, minutes and seconds to the I8 format. I quickly put together this small tool for him.
Blog
(Single-Entry, ) Single-Exit, my 2 cents
As a reaction to this articleat Peter Ritchie’s MVP Blog, I thought I’d give my two cents on having a single exit point for methods. Here we go…
When writing code, I always create only one exit point except for the occasional throwing of an exception. Most important for me is to always know where your code (really) stops. In case of long and complex methods there’s a chance you’re going to miss a return statement when scanning through a method.
Blog
Now available: PowerCommands for Visual Studio 2008
One of the most annoying things in Visual Studio (to me) was the fact that complete solutions (solution folders, projects, regulare folder) would be expanded upon opening. And with big solutions, that isn’t too much fun. There are macros available online, but the ones i found were pretty slow. This is only one of the things that the PowerCommands for Visual Studio 2008 solves for you. But there is more. Much more!
Blog
PageRequestManagerServerErrorException (status code 500)
In a quick AJAX demo I had to create today, I ran into a (somewhat cryptic) PageRequestManagerServerErrorException. I needed a simple form of the Cascading Dropdown{.}, one that doesn’t use a (web)service for its data, but gets it from a simple method. Here’s the setup, and the cause…
Lets start with the exact error message:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server.
Blog
.NET Framework versioning, or The impact of switching from Visual Studio 2005 to 2008
With the official release of Visual Studio 2008 coming closer and its release on MSDN last november, there are more and more people asking what the impact of migrating from VS2005 to VS2008 will be and if it will have as big an impact as switching from VS2003 to VS2005 had. The answer is pretty simple: no it won’t. Let’s see why, and what impact it will have.
VS2003 > VS2005
Blog
Hooray (x 2) for MSDN library Community content
There are several steps to creating a custom web service to be hosted in SharePoint. The MSDN library{.} has a walkthrough on creating a custom web service{.}. After having followed this walkthrough thoroughly, I though my web service was good to go. Unfortunately all I saw was an error: “Could not load type ‘ThisAndThat’ from assembly ‘SoAndSo’”. Just as I was about to search for an answer somewhere online, I remembered that the MSDN library features the Community content for little over a year now{.
Blog
.NET framework source code now available
As stated on ScottGu’s blog{.} in his latest post{.}, the .NET Framework Library Source Code is now available. A detailed blog post about the steps to follow to enable .NET Framework source access in Visual Studio 2008 can be found at Shawn Burke’s blog in this post{.}.
Taken from Scott’s post:
Once you follow the configuration steps in Shawn’s post above, you’ll be able to dynamically load the debug symbols for .
Blog
Finally getting some coding done
The last weeks have been filled with holidays and introductional days at my new employer{.}. Because of that, I haven’t had the time to realy dive into Visual Studio 2008, although I have played around with it since the RTM version was available. Since this week I’ve been writing some serious code in VS2008 for my new personal site (more about this later!). I can only agree with what Pieter de Bruinsaid in his post about the new line of developer tools and additions: “If you are building .
Blog
“Some of the properties associated with the solution could not be read”
Next to the message in the subject, one of the symptoms we encountered is that although the solution contains some test projects the ‘Create private accessor’ menu has disappeared. Also, selecting ‘Create unit tests…’ produces an error. And when editing a testrun config and selecting the ‘Code coverage’ option, the settings dialog simply closes, without any message.
All these (and probably more) symptoms can occur because of a corrupt solution file.
Blog
Project template doesn’t understand AssemblyName tag?
At my current project we made a project template for Visual Studio for our testers. We added all the references, folders and files a tester needs to add a new system tests project. One of the testers (!) extended our XML generator, which generated XML testcases based on data entered in Excel, to now generate a complete C# test class. Making (system) tests which are automatically run during the nightly build now really is just as simple as entering data in Excel.
Blog
Nerd alert?
I have lots of games for my Xbox 360 I still need to / want to finish, like The Orange Box and Bioshock. And despite this, I’ve been working ’non-stop’ behind my laptop for the last two evenings to prepare it for Visual Studio 2008, and to download and install it. It’s almost time… 😉
I can’t wait to get busy with the final version of Visual Studio 2008 and stuff like LINQ, extension methods, anonymous types, lambda expressions and so on.
Blog
This is NOT a test.
Test Driven Development is hot, just like unit testing your software and any other kinds of (automated) testing. And as we all know: sometimes stuff that’s hot is misinterpreted, explained wrong or just simply used in a really bad way. Unfortunately, testing is no exception to this rule…
Not too long ago I had a discussion with a project manager who told me the code in his project had a code coverage close to 100%.
Blog
HowTo: Set the Theme for a MasterPage (from code)
The MasterPage doesn’t have a property for setting the Theme at design time. Despite this, I wanted to set the Theme for a MasterPage, so I decided to set it from code. I was aware of the possibility to set the Theme through the web.config, but that wasn’t the way I wanted to set it. One of the reasons being it would result in the theme being applied to the entire website.
Blog
Build problem – Solved
Yesterday, I posted about a problem with MSBuild building our solution. We solved it, so I wanted to let you in on the secretsolution.
We use the Enterprise Library V1.2 in some of our projects. And because some of the projects are being re-used from other internal projects, not all the references in thos projects were checked for versions. As it turned out, another project had a reference to an enterprise library assembly with a runtime version of .
Blog
MSBuild – Compilation error
Our current project uses the possibilities of MSBuild to have a daily build on a TFS server. This has been working up until yesterday somewhere around noon. Nobody knows what exactly happened, but it stopped working after our successful build of 11:42 am.
_Our problem:
_ Compilation of one project (of a total of 71 projects) is failing. The project builds successful on the local machines of all the developers. It references EnterpriseLibrary.
Blog
MSBUILD : warning : Specified cast is not valid
At my current project we use Team Foundation Server together with the possibility to have a daily build through MSBuild. Over the weekend, the build failed. Because our ‘build master’ called in sick this morning, I took it upon me to fix the build. But compiling the sources was no problem, because that finished without any errors. And there were no failing (unit)tests. Even better: there were no tests which had run at all!
Blog
Unit Test Adapter threw an exception
“Unit Test Adapter threw exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information..”
This error popped up at one of the testers of our project this morning. The unittests he selected worked fine on my machine, but all failed on his with the above message. After searching a bit we found that the only thing which was different between my testrunconfig and his was that he enabled code coverage for the assembly these unittests were pounding away at.
Blog
My new configs, and more …
It took me a while, but in the end everything worked out and life’s good… Most important changes are I have my very own server now, containing all the general stuff like mail, music, development stuff and that kind of data.
My workstation received a small update (I was able to upgrade based on the ‘old’ machine of a friend) and is now running Vista quite smoothly. To be honest, I haven’t found any major issues yet.
Blog
Why would you?
Last week I ran into a variable called @continue in the sourcecode of a project I’m reviewing. At first I had to think a bit before I knew what the @ was for. Of course I knew it’s an escape character when used in front of a string value. But when used in front of a variable name? In that case, it is an escape character also, but this time for the name of your variable.
Blog
UIPAB with ASP.NET 2.0 – our solution
As I posted earlier we had some trouble with upgrading the UIPAB to be used in a ASP.NET 2.0 Web Application Project. Eventually, we solved the problem and life was good. Almost a week ago I received a mail through my blog from someone looking for the solution. So here we go…
We changed a few lines in the UIPAB WebFormViewManager. The problem was in determining the application path in the method ‘RedirectToNextView’.
Blog
Cannot create/shadow copy ‘your assembly info here’ when that file already exists
I encountered his error for the first time today. A Web Application Project I’ve been working on for the last months started throwing this error today almost every time I wanted to debug the project. The assembly info changed from time to time, but the error was the same. Most of the time I could ‘repair’ it by closing the ASP.NET development server. But sometimes, even that didn’t work.
After the first time it hit me today, I kept encountering this until I was fed up.
Blog
Defensive programming
We all encountered them in the field somewhere along the way: pieces of code that are based on assumptions. There’s something fundamentally wrong in assuming when writing code. I can understand that, looking at the big picture, you sometimes have to make an assumption when developing software. Some things you just can’t know for sure. This might concern something simple like the resolution of the targeted audience. But most of the time these kinds of assumptions are based on experience or plain old common sense.
Blog
ASP.NET (2.0) AJAX extensions version 1.0 released
Scott Guthrie announced it January 23rd: version 1.0 of the ASP.NET AJAX extensions has been released. Good news … !
Scott also added a post containing Links to ASP.NET AJAX 1.0 resources, and answers to some common questions. A good read for people who would like to get started on AJAX. It catches some of the common problems you might encounter when you get started with the ASP.NET AJAX extensions. I liked the addition 2.
Blog
UIPAB trouble upgrading to ASP.NET 2.0 Web Application Project
We’re working to upgrade our current ASP.NET 1.1 project to an ASP.NET 2.0 Web Application project (so that’s not the new Visual Studio 2005 website model). We had some basic minor migration issues, which have all been addressed and are currently solved. The only problem we have right now is with the UIP Application Block. There are several people online stating they’ve got UIPAB working in a .NET 2.0 project. Unfortunately, we haven’t got it working… yet 😉
Blog
Getting the computername of the host of a VMware image
Because of a new way of working here at the customer I’m located at, two virtual machines will be deployed to each developer’s machine. These VM’s will be run using VMware player. The thing is, the VM’s should be able to access the network and all the ’normal’ resources. Because of this, all the VM’s should have unique (computer)names. But they have to be traceable to the host machine.
The wish the customer has at this point is to give the VM’s a computername based on the name of the machine the VM will be run on.
Blog
Basic .NET training
Together with a colleague, I’m giving basic .NET training for colleagues at this moment. Not at THIS moment exactly, because they’re doing exercises right now. But today is the second day of four days of training in total. Currently we already have two weird things popping up.
Last week we encountered significant inaccuracy when calculating values using doubles. For instance, when adding 0.1 to a double (instantiated at 0) several times, the value wondered off.
Blog
New MSDN Library provides IE7 Search provider
MSDN 2 Library has been online for a while now. When you visit the ‘old’ MSDN library, you see the following text:
“We’re upgrading the MSDN Library to a new publishing system which provides improved performance, better search relevance, XHTML compliance, URLs which don’t change after product releases, and more. During the next few months we’ll gradually move content over to the new site, although MSDN Search will work across both sites automatically.
Blog
Unexpected behaviour when calling overriden method
Since not too long ago, I joined the MSDN Forums. The MSDN Forums is a big community where lots of knowledge is passed around. I recommend joining.
Yesterday I ran into an interesting post. It’s about an overriding method that exactly seems to match the call, but doesn’t get called. In stead, the base method is called… Apparently this is because of override-resolution starting at the base working its way up, and a method declaration that matches more than you would think it does.
Blog
Consolas font – my 2 cents
“Consolas is a monospaced font (like an old typewriter) and good for programmers setting code (its core purpose).”
The above quote is taken from the Microsoft Design website, and specifically the part about ClearType fonts. It states the main reason for developing the Consolas Font Pack (download here) is to develop a better font for ‘programmers setting code’. Because of this, I primarily tested Consolas in Visual Studio, my editor of choice when writing code 😉
Blog
‘protected internal’ != (‘protected’ & ‘internal’)
Having a database management class called DatabaseManager, I wanted to make a property for this DatabaseManager in a BaseForm. This way, every form inheriting from BaseForm would be able to use the same instance of the DatabaseManager.
Because the DatabaseManager exposes functionality to interact with the database, I wanted it to be internal. The property for the DatabaseManager in the BaseForm would have to be internal and protected, so only derived forms would be able to use the property.
Blog
Assess your Microsoft skills
Recently I ran into the Microsoft Skills Assessment page. After singing in with your passport, you can take all kinds of skills assessments for various Microsoft products, from Visual Studio 2005 to Windows Storage Server 2003.
Because I’m looking in to getting an MCPD certification, I was curious about how I would score without even preparing for a test. It’s pretty neat to be scoring 80% on the first test I took: Microsoft® Windows®-based Client Development with Microsoft Visual Studio® 2005 and Microsoft Visual C#®.
Blog
Houston, we have an upgrade…
BloggingAbout.NET was upgraded today! We are now CommunityServer 2.0 enabled. Because of this, I also changed the look and the description of my blog. Why not do everything at once 😉
One little extra piece of information: since the update it is no longer possible to reach a blog by typing in the url bloggingabout.net/username. This has been an extra service since blogginabout.net went to CommunityServer 1.1. Now, whit the upgrade to 2.
Blog
On Risk-based Software Development (and a hint of Madonna)
<p> </span><span lang="EN-GB">People tend to push difficult work back. I have to admit it can be more appealing to start out with a highly interesting or fun part of the work that needs to be done, in stead of doing the difficult stuff first. I’ve done that myself in the past. But by doing that you enable <a href="https://en.wikipedia.org/wiki/Murphy's_law">Mr. Murphy</a> to come and ruin your project. Especially when his visit occurs in the final phase of your project!
Blog
Error: Could not instantiate activex control ‘xxxx-xxx’ because the current thread is not in a single threaded apartment
At our current project, we have an application which is deployed using No Touch Deployment. Because of some SEHException we got a few months back, we started our application in a separate thread using a launcher class which contains the Main() method for the application. Recently we added functionality to display HTML pages our application generates, so we added the ActiveX webbrowser (in AxSHDocVw.dll).<p> thread.ApartmentState = ApartmentState.STA;<br /> </font><font size="2"><br /> thread.
Blog
IIS 7.0 on the MSDN .NET show
ScottGu blogged about IIS 7.0 on the MSDN .NET show. He and Bill Staples did an interview on IIS 7.0, which will ship with Windows Vista Beta 2. As Scott said: IIS 7.0 is a major, major update and improvement to the overall Microsoft web platform stack. See it. You can find it here.
Blog
HowTo: determine which object (and method) called another method
Sometimes when you’re inside a method you would like to know which method called it. Or even which object. For instance when you write a TraceListener, it might be pretty cool to make the TraceListener smart enough to find out what object called him and from which method. The StackTrace object in .NET makes this pretty easy. Here’s a howto…
First, we iterate through the stackframes that are available on the stack, looking for the one we need.
Blog
Cannot widen from target type to primitive type.
A few days ago we ran into the error in the subject of this post at my current project. Because it wasn’t easy finding any usefull hints pointing towards a solution, I’ll post ours here.
We use reflection for flexible databinding, based on types and their attributes. One of the methods we wrote sets a value, passed in as an object, on a specific attribute of a specific class. The method knows nothing about the class and its properties.
Blog
BloggingAbout .NET meeting?
I’ve been thinking: would there be any interest for a bloggingabout .net meeting among the bloggers? We are all into .NET and most of us seem to enjoy a good discussion. Maybe we can organize a platform for those discussions in real life in stead of through posts and comments. It could be about anything, but has to have a predefined agenda to make sure the meeting has a goal.
Blog
SecurityException: That assembly does not allow partially trusted callers.
The exception mentioned in the title of this post was the one I encountered when using an ASP.NET control I had written.
**How I encountered the exception:
** Because I develop several websites, there’s a lot of functionality I need more than once. A possible solution for this is to write a control gallery containing the functionality I needed. And putting them in a seperate assembly makes it easy to dstribute them freely in the near future ;).
Blog
Visual Studio 2005 IDE bug
Yesterday we ran into a bug in the Visual Studio 2005 IDE. To be precise: in Intellisense when writing a web.sitemap file. The Intellisense tells you the attribute which indicates whether a site map provider filters site map nodes based on a user’s role is called securityTrimmingEnabled. But when you use this attribute and run the website, you receive an error stating there is an Unrecognized attribute ‘securityTrimmingEnabled’.
When you look the attribute up in the help, it is called SecurityTrimmingEnabled.
Blog
BizTalk 2006 course
Wednesday and thursday I attended the first part of a BizTalk 2006 course at Class-A. Next week I’ll be finishing the course (tuesday and wednesday). I have to say that the trainer/coach who gives the course (Astrid Hackenberg) really knows what she’s talking about. At this point the 12 (?) people attending the course have not yet come up with a question she couldn’t answer.
The first two days weren’t very difficult, I think because they were an introduction to the basics of BizTalk.
Blog
Agile Software Development, Principles, Patterns, and Practices
Last week a book I requested arrived: Agile Software Development, Principles, Patterns, and Practices by Robert C. Martin. I haven’t had the time to dive in to it, but my first impression is this book is a good one. Nice quote I ran into on the first page, as one of the principles agile development follows:
Simplicity – The art of maximizing the amount of work not done.
Blog
HowTo: read your configfile when using no-touch deployment
Earlier I posted about reading a configfile when using no-touch deployment. Several people have contacted me to post the code, so here it is.
Blog
ASP.NET 2.0 menu rendering differently in browser and at w3.org validator
I ran in to something strange today…
The ASP.NET 2.0 Menu control renders differently in a browser and in the W3 validator. Loading the page in a browser results in the usage of the correct attribute ‘vertical-align’ for the image which is used to indicate a menu has subitems. I checked this in IE and FireFox and both browsers rendered correct XHTML. When you copy the source of the rendered page and paste it in the validator-textbox at W3.
Blog
Binary .NET remoting over https: throwing errors serverside
As a follow-up to my previous post..
Eventually a colleague of mine pointed me in the right direction. The System.Runtime.Remoting part of a configfile can also contain a tag. Setting it to “Off” made that I got the expected exception. Thanks Jasper!
Blog
.NET remoting (http binary): passing (custom) errors
We are using binary .NET remoting over http for a client-server application. At the server, we have implemented custom error handling which results in the Service Interface (the facade layer) to throw a decent exception, with lots of information. The problem we encounter now is that most of the time the client displays these exceptions as BinaryFormatter exceptions, in stead of the ApplicationException or the normal Exception we throw serverside.
Blog
No-touch deployment & reading your config file
When you use No-touch deployment, reading your config file might cause some problems.
I experienced this when I received a ‘No message was deserialized prior to calling the DispatchChannelSink’ error last week. It took me quite some time before I found the problem, because of the strange error. After a while I thought about the way my app was starting: I started a separate thread which configured a remoting interface based on the config file: RemotingConfiguration.
Blog
VS2005, a first look
Last week I played with VS2005 a little. My first overall impression is: sweet! Partial classes, nullable types, generics, master pages, new controls, great extra debug info… they all make our life a little easier.
Still, some things are rather funny. For instance: why can’t you see webpage-events any more, but do you have to write them yourself combined with auto event wireup? On one hand, I could imagine that the use of (too many) page events is not the right thing to do, and that’s the reason they made it a bit harder.
Blog
Howto: create a custom httpHandler
If you would like to (for example) make sure all the jpegs on your site are displayed including a copyright text or something like that, you could use the example I posted before. But it would be easier to write a custom httpHandler. Here’s a small howto:
Add a class to a WebApplication, and give it a decent name. Mine is customHandler.
Have the class implement the IHttpHandler interface (found in the System.
Blog
HowTo: implement a list that sorts based on value ( not key ! )
<div> <font face="Courier New"> <font color="#0000ff">private string</font> theKey;</font> </div> <div> <font face="Courier New"> <font color="#0000ff">private string</font> theValue;</font> </div> <div> <font face="Courier New"> </font> </div> <div> <font face="Courier New"> <font color="#0000ff">public string</font> Key</font> </div> <div> <font face="Courier New"> {</font> </div> <div> <font face="Courier New"> <font color="#0000ff">get</font></font> </div> <div> <font face="Courier New"> {</font> </div> <div> <font face="Courier New"> <font color="#0000ff">return</font> theKey;</font> </div> <div> <font face="Courier New"> }</font> </div> <div> <font face="Courier New"> }</font> </div> <div> <font face="Courier New"> </font> </div> <div> <font face="Courier New"> <font color="#0000ff">public string</font> Value</font> </div> <div> <font face="Courier New"> {</font> </div> <div> <font face="Courier New"> <font color="#0000ff">get</font></font> </div> <div> <font face="Courier New"> {</font> </div> <div> <font face="Courier New"> <font color="#0000ff">return</font> theValue;</font> </div> <div> <font face="Courier New"> }</font> </div> <div> <font face="Courier New"> }</font> </div> <div> <font face="Courier New"> </font> </div> <div> <font face="Courier New"> <font color="#0000ff">public</font> KeyValuePair(<font color="#0000ff">string</font> key, <font color="#0000ff">string</font> value)</font> </div> <div> <font face="Courier New"> {</font> </div> <div> <font face="Courier New"> theKey = key;</font> </div> <div> <font face="Courier New"> theValue = value;</font> </div> <div> <font face="Courier New"> }</font> </div> <div> <font face="Courier New"> </font> </div> <div> <font face="Courier New"> <font color="#0000ff">public int</font> CompareTo(<font color="#0000ff">object</font> obj)</font> </div> <div> <font face="Courier New"> {</font> </div> <div> <font face="Courier New"> <font color="#0000ff">if</font> (obj == <font color="#0000ff">null</font>)</font> </div> <div> <font face="Courier New"> {</font> </div> <div> <font face="Courier New"> <font color="#0000ff">return</font> 1;</font> </div> <div> <font face="Courier New"> }</font> </div> <div> <font face="Courier New"> <font color="#0000ff">else</font></font> </div> <div> <font face="Courier New"> {</font> </div> <div> <font face="Courier New"> KeyValuePair check = (KeyValuePair)obj;</font> </div> <div> <font face="Courier New"> <font color="#0000ff">return</font> Value.
Blog
HowTo: Thread safe singleton implementation of a class
Normally, if you would like a singleton implementation of a class, you would go about it a little bit like this:
<p> </font></font></font>The trouble here is that this implementation is not thread safe. The reason I post this is I recently ran into some code of an old colleague of mine (from my former employee) and some tests showed his singleton class was instantiated several times when the application was stressed with requests from the start, which caused unwanted lag in the application.
Blog
Structuring your projects
At my current project, I’m trying to bring some structure in our visual Studio projects. But I’m finding myself not sure about how far I should go. Maybe you should know I tend to be something of a purist. At the moment, we created a project with a single class, because it didn’t belong anywhere else. So we created a client specific ‘Common’ project and put the one file there.
Blog
Remoting, serialization error, CallContext, Clone()
I couldn’t come up with a decent title for this post, so I just spit out some keywords.
We got an error today, stating the Controller of some object we wanted to put on CallContext needed to be serializable. Not thinking about the weird content of this error, we tried what would happen if we made the controller serializable. We now got a different error, which was even more weird:
Blog
Design guidelines – again
I saw a presentation monday to explain the basics of .NET to some starting developers. In that presentation, I saw a piece of code design I don’t think should be showed. Ever. Especially to people who are about to enter the .NET world. In one cs-file, I saw a base class, two inheriting classes and then again two classes which inherited from on of the former mentioned classes. So there were 5 public classes in one file.
Blog
Advanced remoting – “No assembly associated with XML key”
For my current project I’m trying to implement a factory pattern using remoting. This seems to be more difficult than I imagined. I’ve done the following:
– Create an Interfaces project containing an IProductFactory and an IProduct.
– Create a Class Library which implements Product and ProductFactory and is hosted in IIS through a web.config.
– Create a project which makes a ProductFactory and uses this to create a product, all based on the interfaces.
Blog
JetBrains ReSharper 2.0 – First impression
Dennis blogged about it earlier today, and as soon as I saw that I couldn’t help myself: I had to try out ReSharper 2.0! Little did I know about the consequences…
I love ReSharper 1. There are some small weird things, but overall I just love it, despite its little quirks. So 2.0 had to be even better! Unfortunately, it doesn’t seem that way. Visual Studio now takes forever to start, the second project I opened made ReSharper crash hard (VS had to be restarted to get life back into it), assembly-parsing is still done in a modal dialog in stead of in the promised background process, it keeps annoying me with two windows I definitely don’t want to see and last but not least: the bar next to the scrollbar now displays an ugly 3D-attempted square.
Blog
Did you know: Visual Studio help ‘tabbed browsing’
Holding down the SHIFT key when you click a link in the Visual Studio help (using external help) opens the topic in a new tab in the help browser. So that’s a form of tabbed browsing. Sweet.
And pretty helpful when you would like to keep open the previous help topic you were in…
Blog
The conditional operator (? :)
Every now and again I see a piece of code where the author has used the conditional operator ? : . It might be my tidyness or it might take some getting used to, but I don’t like it. I don’t like it at all! My gut feeling says it’s nasty, because it’s not easy readable code. Lets look at an example. Imagine you have a property getter for the count of a collection.
Blog
ASP.NET 2.0
If you’re interested in Visual Studio 2005, and especially ASP.NET 2.0, visit this site: https://beta.asp.net/ It’s an official Microsoft beta site running ASP.NET 2.0. Including forum, a control gallery, tutorials, starter kits and many more!
Blog
CoolToolList.Add(CLRProfiler);
<LI class="MsoNormal"> <SPAN lang="EN-US">Which methods allocate which types of objects?</SPAN><br /> <LI class="MsoNormal"> <SPAN lang="EN-US">Which objects survive?</SPAN><br /> <LI class="MsoNormal"> <SPAN lang="EN-US">What is on the heap?</SPAN><br /> <LI class="MsoNormal"> <SPAN lang="EN-US">What keeps objects alive?</SPAN> </LI></UL> <br /> <LI class="MsoNormal"> <SPAN lang="EN-US">Additionally:</SPAN><br /> <UL type="circle"> <br /> <LI class="MsoNormal"> <SPAN lang="EN-US">The call graph feature lets you see who is calling whom how often.</SPAN><br /> <LI class="MsoNormal"> <SPAN lang="EN-US">Which methods, classes, modules get pulled in by whom</SPAN> </LI></UL> <br /> <LI class="MsoNormal"> <SPAN lang="EN-US">The tool can profile applications, services, and ASP</SPAN><SPAN lang="EN-US">.
Blog
Howto: present a Crystal Reports report as a PDF in an ASP.NET web application (without using temporary files)
This one is actually quite simple: Crystal Reports supports exporting to a PDF. Exporting can be done to disk, or to a stream. And a stream can be written to the Repsonse property of a page. And there you go 😉
// Variable declarationCrystalTest crystalTest;MemoryStream memoryStream;// Create a new instance of the report you want to display as a PDFcrystalTest = newCrystalTest();// TODO: Add some stuff here to fill the report with data// Export the report to a stream with the PDF formatmemoryStream = (MemoryStream)crystalTest.
Blog
ASP.NET – Configuration error. Parser Error Message: Access is denied: somename.dll
My last message was about this strange error I received. Today I got it again, which led me to believe a hardware failure was not the reason. So after some more investigation I found out Index Server was to blaim. Taken from support.microsoft.com (click here for full article):
If you run Index Server (Cisvc.exe), then Index Server may rescan the Temporary ASP.NET Files directory while it requests a Microsoft ASP.NET page.
Blog
ASP.NET error concerning referenced DLL
I’ve been using skmmenu for quite a while now, and I think it’s great! But last Friday I was fooling around in Visual Studio, trying to make some fun stuff in ASP.NET, when I got a strange error about a reference. The information part:
_ === Pre-bind state information ===
LOG: DisplayName = skmmenu
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/Site
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===_
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
Blog
Did you know… Visual SourceSafe “Keyword Expansion Support”
Although we’re not using SourceSafe at my current project (yet), I found out about a cool feature recently: Keyword Expansion. It enables you to get information about the revision, date, author and so on of the version of the file you are looking at inside the file itself. This way you can see version information in the comments of your code-file, without even starting SourceSafe.
Taken from an MSDN entry about VS2k5:
Blog
ComboBox trouble
The default ComboBox has some weird characteristics…We created our own control which derives from the ComboBox because we wanted to create a ComboBox where the user could type (parts of) the value he or she wants to select, but would not be able to type something that was not in the list. So that’s kind of a combination between the DropDownStyles DropDownand DropDownList. The basics weren’t that complicated, so we created the controls pretty fast.
Blog
HOWTO: display your assembly @ Add Reference
You might want to be able to let your assembly show up in the Add Reference window in Visual Studio without the user having to browse for it. When you install your assembly in the GAC, it doesn’t automatically show up in the Add Reference window, because it doesn’t enumerate all assemblies in the GAC. Installing in the GAC only eliminates the need to copy assemblies localy when referencing them. Microsoft doesn’t recommend putting assemblies in the GAC by the way…
Blog
A failure occurred writing to the resources file. The system could not find the file specified.
We received the above error for the resx file of a form in our project today. So we checked the existence of the resx file it concerned, and it was there. So maybe the file was corrupt? We deleted the file, removed it from the project and let Visual Studio re-create it by editing the form in the designer. Building the solution gave the same error… again the file was right where it was supposed to be.
Blog
A custom SOAP fault handler and a ‘Reference not set to an instance of an object’ error …
Today we had a problem on the project I am working on. To be more precise: I had a problem, the other team members did not.
Quick explanation: We have a server component which uses a web service for some of the functionality we need. Other functionality can be found in a different system which is reachable through IBM WebSphere MQ. The server component is available through remoting, the objects are hosted in IIS.
Blog
Visual Studio .NET Bootstrapper
Have you ever made an install for your application with Visual Studio and sent it out into the world, only to get complaints of people that your software wouldn’t run?
“Have you got the Microsoft .NET framework installed?”
“The what?”
“Go look in control panel, …… ……”
“Ow, yeah, I got that”
“Hmmm….”
“So ehm….”
“What version is it?”
“Version? …. wait …. it’s 1.0”
“Darn, download it and …”
Blog
Controls disappear from the Windows Forms Designer in VS2k3
We recently ran into the problem mentioned in the title of this post at work. Microsoft has a knowledgebase article (kbid 842706) for this bug. The hotfix is not to be distributed freely, but I already spoke to some people who have contacted Microsoft and got the fix for free. It will be e-mailed to you.
As you can read in the comments of this post at dotnetjunkies, there are some people who found no more problems after installing hotfixes KB841870 and KB841767-X86… I think that’s weird (but I’m not arguing!
Blog
HOWTO: Encode a password using MD5 in C# (or: howto calculate the MD5 hash for a string)
The following method returns the MD5 hash for any given string. For instance for a password. It might be of some assistance when you’re trying to validate user credentials but you don’t want to store the password readable in the database.
For this method, you’ll need the following using statements:
using System; using System.Text; using System.Security.Cryptography; [...] public string EncodePassword(string originalPassword) { //Declarations Byte[] originalBytes; Byte[] encodedBytes; MD5 md5; //Instantiate MD5CryptoServiceProvider, get bytes for original password and compute hash (encoded password) md5 = new MD5CryptoServiceProvider(); originalBytes = ASCIIEncoding.
Blog
Commenting your code – The sequel
As Ernst put it in the comments: we opened a can of worms here!
In my previous post about Commenting your code, I stated you should not comment your code. Of course, this is nonsense. The reason I stated that, however, isn’t. And I didn’t only say that because I would get some attention 😉
Too many times, I see complete useless naming of variables, classes, methods and so on. Because of this incomprehensible naming the developer who wrote the code then has to place enormous amounts of comments between his code to keep it even remotely understandable, even to himself.
Blog
Commenting your code
There are several ways to comment your code. There’s the style where you place comments on the same line as the code. This might get less readable, because there’s some horizontal scrolling involved when your statements get longer. An example:
string s; //Declare string s = e.Message; //Assign exception message to string s Another way to place comments in your code is to place every comment on its own line. This is less readable when you get long methods, because your methods will get twice as long because of the comments!
Blog
HOWTO: Draw your own string (URL, copyright) on each displayed picture in an ASP.NET website
The AdRotator .NET provides can be used to show a different image each time a page is visited. You could write a webpage which does this for you, but it’s probably not very useful. Although you need to change the XML file when changing the images to be showed when you use an AdRotator, but that’s not the issue here.
Something .NET doesn’t deliver is a control to add your own text to an image when it is displayed on a webpage.
Blog
HOWTO: create an animated GIF using .NET (C#)
.NET does not give you possibilities to create animated GIFs through GDI+. At least 1.1 doesn’t, they might incorporate it in 2.0. But there are ways to make them! This solution is one I used myself, and I’m very pleased!
//Variable declaration StringCollection stringCollection; MemoryStream memoryStream; BinaryWriter binaryWriter; Image image; Byte[] buf1; Byte[] buf2; Byte[] buf3; //Variable declaration stringCollection = a_StringCollection_containing_images; Response.ContentType = “Image/gif”; memoryStream = new MemoryStream(); buf2 = new Byte[19]; buf3 = new Byte[8]; buf2[0] = 33; //extension introducer buf2[1] = 255; //application extension buf2[2] = 11; //size of block buf2[3] = 78; //N buf2[4] = 69; //E buf2[5] = 84; //T buf2[6] = 83; //S buf2[7] = 67; //C buf2[8] = 65; //A buf2[9] = 80; //P buf2[10] = 69; //E buf2[11] = 50; //2 buf2[12] = 46; //.
Blog
Configuring an ASP.NET app for multiple login locations with forms authentication
The title isn’t descriptive enough for this post, but it will have to do. Today I was trying to get an ASP.NET application to allow me to define two different login levels. What I was trying to do was the following:
There’s a main ASP.NET application, which is allowed to be accessed by anyone (<allow users="*"> at https://www.domain.com/)
There’s a customer part where a login is required. (https://www.domain.com/customers/)
There’s a maintenance part where a different login is required.
Blog
Visual Studio Powertoys!
I stumbled upon a great workspace at GotDotNet: Visual Studio Core Community Powertoys. Here you can find some pretty neat powertoys for the Visual Studio IDE. For example:
Go Back Visual Studio Add-In
The Go Back Add-in provides a Navigate Backward functionality that is different than the normal Navigate Backward functionality. (Which does some neat things like close a file if you happened to have opened it while navigating forward)
Blog
Regular expression tools
At the Powertoys Weblog, Sara Ford posted about a very cool tool which is available at gotdotnet: Regex Builder.
At gotdotnet it is described as follows:
A tool for building and testing Regular Expressions. It allows you to manipulate the expression and your source text, and shows you a tree with all of the Matches, Groups, and Captures found in the text.
I think this tool is easier to use for RegEx beginners than for instance The Regulator, because its GUI is pretty simple and there’s some standard information available at startup.
Blog
My first BIG Visual Studio 2003 crash – Update
The last couple of years I’ve had small Visual Studio crashes, where Visual Studio stopped and asked me if I wanted to restart and reopen the current project. These crashes never meant a loss of work. Today I had the first BIG VS2K3 crash and this time it did cost me. A lot…
I’m wondering why VS stopped responding completely. The network here at our client isn’t that fast this morning, but I can not imagine this being the problem.
Blog
Visual Studio .NET 2005 – Beta 2
Sure, I’m not the first one to blog about it. But I still didn’t want it to go unnoticed… Visual Studio .NET 2005 Beta 2 is out now. (Available for people with MSDN subscriptions)
For those of you who don’t have an MSDN subscription, the Express Editions can give an idea of the power .NET 2.0 will bring to you.
The first impressions of people around me are good. Better yet, those first impressions are VERY good.
Blog
.NET Refactoring
Most of you probably know about the refactoring options Visual Studio 2005 will deliver to us. For those of you who would like to experience what refactoring, using optimization, partial code generation and more feels like without waiting for VS2K5, you should try JetBrains’ ReSharper. I installed it yesterday (after having downloaded it a few weeks ago) and it’s a great addition to the Visual Studio development environment.
And having experienced this, I want VS2K5 to come out even sooner….
Blog
Datagrid revised
Dino Esposito wrote an excellent article on the new and improved DataGridView control in .NET 2.0 in the .NET magazine of April this year. It explains the possibilities the newly built gridcontrol gives you. Finally a decent grid control…
Curious what .NET 2.0 will bring you? This is a must read!
Blog
Access 2003 now SourceSafe enabled
If you’ve ever worked with Access XP or earlier in combination with SourceSafe 6 and are now using Access 2003, you might miss the SourceSafe capabilities in Access. Out of the box, Access 2003 did not support putting your Access stuff in Sourcesafe. Microsoft has now released an Access 2003 add-in for this! So, if you would like your Access 2003 program to be taken into source code control: it now can.
Blog
Source code control for Visual Studio 2005
The hype surrounding Visual Studio 2005 almost makes you not notice all the other upcoming Microsoft developer products which will accompany VS2K5. One of these products is the new source code control system. This January at the ASP.NET 2.0 roadshow in Amsterdam, Scott Guthrie (leading engineer on the ASP.NET 2.0 team) described the new source code control system as ‘SourceSafe done right’.
Microsoft will be delivering Team Foundation which not only will allow you to add source control to your solutions, but also makes it easier to track work items as their status is available at all time.
Blog
Internal MS coding guidelines
Brad Abrams posted the internal MS Coding guidelines on his blog earlier this year.
Interesting reading stuff!
I tested my own code against these guidelines. I think I would pass…. 😉
Blog
Converting string to Enum value
Questa posted a very usefull piece of code…
It’s possible to convert a string representation of an enum back to an enum!
private enum MyEnumeration { FooBar, Foo, Bar } ... MyEnum foo = MyEnum.Foo; foobar = foo.ToString(); MyEnum bar = (MyEnum)Enum.Parse(typeof(MyEnum), foobar); At the end of this code, the variable bar has the MyEnum value Foo, just the way it’s supposed to be…
Blog
“Object does not match target type” error calling a method on an assembly loaded using reflection
Actually, the cause for this error is very small and simple. But because the error doesn’t clearly state what’s wrong and there’s not a lot to be found about this, I’ll post it here anyway… Otherwise, you might be looking for this for a while, while it’s so easy!
When you are loading an assembly using reflection and you want to call a method from the class that’s in the loaded assembly, you might get the error Object does not match target type.
Blog
Creating events using delegates
After promising you a post on using delegates to create events several times, I’m now using my break to post it. Because it will be a while if I wait until I can find the time… 😉
As I mentioned earlier a delegate can be seen as an interface for a method. Because you don’t know what the method that will handle an event on your user control will look like, delegates are a great way to provide your user control with events.
Blog
Creating events using delegates
Stored Procedures rule, because they facilitate manipulating the dataset you get from a database or the way you are inserting or deleting data in a database without changing your application. Or your business layer for that matter. But you can’t always use stored procedures for the actions you would like your application to take. Or maybe your database doesn’t support stored procedures. In that case it’s back to queries for you!
Blog
Is my C# application running in debug mode? or: About pre-processor directives
All I wanted to do was check if my application was running in debug-mode or in release-mode. Searching MSDN library and Google (groups) both did not deliver the solution to me. I was about to let go when, out of the blue, a webpage showed up in my browser telling me the following:
Visual Studio automatically generates a pre-processor directive called DEBUG which is linked to the mode you run your application in.
Blog
Delegates explained
Delegates can be seen as interfaces for methods. Let’s look at an example of a delegate and what it really represents.
delegate double Calculation(double one, double two); All this line of code really does, is tell the class it is in that there might be one or more methods with the given signature: a method returning a double and taking two doubles as parameters. You cannot call a method Calculation now, because it does not have a body, so it doesn’t have any functionality.
Blog
C# XmlSerializer FileNotFound exception
When using XmlSerializer in .NET on a self-made class, you might receive the FileNotFound exception at runtime upon instantiating the serializer. You don’t get enough info to debug this problem, and the filename of the file it didn’t find can’t explain much either, because the dll-name is different ‘garbage’ every time.
XmlSerializerPreCompiler to the rescue Chris Sells has developed the XmlSerializerPreCompiler tool, which gives you more info about why instantiating an XmlSerializer for your class won’t fly.
Blog
ASP.NET 2.0
To be honest, I’m glad I’m not on an ASP.NET project right now. I saw ASP.NET 2.0 in action last Friday, and I would go crazy if I would have to do an ASP.NET 1.1 project now.
2.0 and the new Visual Studio 2005 (Whidbey) take a lot of ‘standard work’ out of the developers’ hands, making development much faster. It begins with something as simple as leaving the cursor where it is while switching between views.
Blog
.NET eye opener
Currently I’m reading the Microsoft Press book“Developing web applications with Microsoft Visual Basic .NET and C# .NET” by Jeff Webb. (This book is part of the very interesting “MCAD/MCSD Self-Paced Training Kit“.) I borrowed this book from the Microsoft Library here at my new job. They’ve got a very wide variety in books! Another plus to add to the list.
Although I’d like to think I’ve mastered quite a part of the .