Assembly reference problem with XAML in .Net 3.5

Labels:

I came across a problem last week, I developed a custom user control for someone, this control use a lot of references. The guy send me an email with an error that say that the user control doesn’t find an assembly reference?

The way that we structure our folders are :

image

The project assembly reference the main assembly of the custom user control, if we compile we normally obtain an output folder which contains all of the 4 assemblies into this picture. But this is not the case, the assembly in red is not copied into the output folder. The reason is because we only use the assembly in red in xaml and not directly in C# code. There is a bug into the Xaml compiler which doesn’t add the reference correctly. So a solution is to add one line of code into the project assembly which construct one instance of any class from the referenced assembly 2 and the classic C# compiler will do the correct job.

Sample

I create a sample solution with 2 projects:
image

The XamlDemo project reference the WpfControlLibrary1. In my Window1.xaml I use the control:
image

I compile, the output folder contains effectively the WpfControlLibrary1, it is VS2008 which take the assembly because it is a project reference. Simply create a new project and reference the XamlDemo assembly and in this case, it will not work. We can see it with reflector:
image

We can see that the XamlDemo.exe doesn’t contain any reference to the WpfControlLibrary1.
Now we add a simple line of code:
image

I use one class of the WpfControlLibrary1 and now in reflector:
image

And now the WpfControlLibrary1 is there, so pay attention to that because it can create deployment problem.







IERssNotificator version 1.2.0.0

Yes, the project is yet alive. This new version adds 3 corrections and 4 improvements :

New stuff added:
................

  • logs error
  • new configuration option to disable the reshow of the notification window at regular interval when posts are unread
    image
  • notification icon change when there are unread posts
    image
  • some layout stuffs improvements like font size on the notification window, added scroll bar if too many unread posts

Bugs corrected:
...............

  • when new post detected the notification window is displayed but doesn't hide after the defined time
  • when click on the the mark feed as read button, it throw a null reference exception
  • if rename/remove/add feed into IE while in the configuration window, the list of feeds are not refreshed.

Download IERssNotificator V1.2.0.0





New release IERssNotificator

The new release of IERssNotificator V1.1.0.0 is ready with a lot of bug fix and new functionalities. All the icons are coming from http://www.pinvoke.com/, great thanks to Yusuke Kamiyamane for these beautiful icons.

Bugs corrected:
...............

 

New stuff added:
................

  • sound alert
  • the list of feeds in the configuration window are shown in tree view like in IE
  • icon read as check mark
  • an about window with the version and a link to the author site

Download IERssNotificator V1.1.0.0





IERssNotificator

Hello, I come now with a soft developped by myself. Since IE7 in xp or in Windows Vista there is a Rss engine/API developped by Microsoft. So every program can use the same Rss list. In IE7 or higher you can manage your Rss list.

image

But if you want to know if there is an update for a feed, you need to open IE and see if the feed is in bold. The main goal of Rss feed is that you don’t need to visit a web site to see if there is an update, and here you must take the action to see if a feed is in bold.
emot106

My tool IERssNotificator is a tool which use the Ms Feed api and which will popup a notification window like a mail software. This tool is developped in C# and WPF.

image

If you click on a post from a feed, it will open the rss page from IE, so I let IE manage reading, adding or removing feeds.

You can choose on which feed you want to receive notification by right clicking on the notification icon and choose configure.

image

You can download this tool, it’s totaly free. I will be happy if you give me some feedback about what you think about the tool, the idea, if there is bug or if you want other functionality.

Donwload IERssNotificator 

Mots cl├ęs Technorati : ,,




Connections to WCF service

Last week I encountered a problem while connecting to a WCF service (more accurate a WWF in a WCF). The error message was : “Client is unable to finish the security negotiation within the configured timeout (00:01:00).  The current negotiation leg is 1 (00:01:00).” A timeout at the security negotiation, why? I have a lot of programs with connections to WCF and I never had this error message before. The reason is the number of connections opened and closed in a certain period of time.

 

Explanation : my program create 20 threads, each thread create a connection to the WCF service, open, do the call and close the connection properly. Why this error message? It’s a windows reason, a socket connection in windows remain not accessible when closed for a period of time, the default is 4 minutes and can be changed by a registry value. The connection is in a pool, and we must ask a connection from the same pool to be able to retrieve the same connection and that’s the problem, each time I create a new connection from a different pool and I reach the maximum allowed sockect connection.

 

How to resolve the problem?

It’s not so difficult, Difficult in WWF.
The pool of connection is created by the ChannelFactory class, so if you create a connection always from the same ChannelFactory, you will use the pool. So don’t use the statis method CreateChannel because you’ll always create a new pool.

 

WCF reference added via “Add service reference” in visual studio (svcutil.exe)

If you add the reference, the generated proxy’ll use the pool.

 

If you create your own proxy

Create a ChannelFactory object, and create the channel always from this object, it’ll use the same socket pool. Don’t call the static method from the ChannelFactory class.

 

From a WWF (worflow)

It’s more difficult because you don’t create the code to call a WCF (you can), you normally use a send activity, by default it doesn’t use the pool. If you want to use the pool, you need to use ChannelManagerService to say on which end point you want to use pooling. If you want to read more about, read the following post about Serge Lucas, it is the detailed solution for this problem.





Microsoft Team Foundation Server Branching Guidance

A new version of tfs branching guidance is now available :

VSTS Rangers

This content was created in a VSTS Ranger project. VSTS Rangers is a special group with members from the VSTS Product Team and Microsoft Services. Their mission is to provide out of band solutions for missing features or guidance.

Microsoft Team Foundation Server Branching Guidance - Home





Increase coverage of your unit test

Today, I come back from the Tech Days in Antwerp and we see a very interesting thing.

A tool that can generate input data for your unit test (business). These input data are not random generated but are calculated to make your unit test to pass through all branches (if, else, catch, ...). The name of this great tool is "Plex", if you want to learn more about it, you can visit the research site : Pex site