Marko Apfel

C#, Architecture, QA, Coach, GIS, ArcGIS, ArcObjects

  Home  |   Contact  |   Syndication    |   Login
  144 Posts | 2 Stories | 73 Comments | 4 Trackbacks

News



Twitter | LinkedIn | Xing

Twitter












Article Categories

Archives

Post Categories

BizTalk

C#

Enterprise Library

SAP

SQL Server

Technologie

Tuesday, March 20, 2012 #

During playing with Entity Framework I got the error:

“Error while trying to run project: Unable to start program ‘'…’.
The endpoint was not reachable.

image

 

By running the project in Visual Studio. Outside VS were no problems.

A similar project runs fine. So I compared both project files. Indeed the first project file contains the line:

<Prefer32bit>false</Prefer32bit>

in some property groups.

After deleting this line everything runs fine.


Tuesday, March 06, 2012 #

Per default ubuntu offers screen resolutions which does not fit for my laptop. My panel allows 1980x1080 but the best fitting choice from ubuntu was 1280x960.

But with some nice commands you could pimp the list of available resolutions:

get the modeline:

cvt 1920 1080

this gives you the hint:

Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

extent the list of modelines (cut the suffix from the resolution for a better name):

sudo xrandr --newmode "1920x1080"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

verify the entry:

sudo xrandr –q

add the entry to the list of available resolutions

sudo xrandr --addmode VBOX0 1920x1080

and voila: you could choose the new resolution under settings


Monday, February 20, 2012 #

Normally the thumbnails at the new tab page are organized by how often you visited a page.

But after removing such a thumbnail by clicking the little gray cross at the right top corner deactivates the logic for this page on the whole. The page is added to an internal black list.

So the idea to visited the site often enough newly does not work to show the thumbnail from this page again.

So we have to choices:

  • reset the black list
  • remove an entry from the blacklist

Reset the black list

By removing another thumbnail from your “New Tab” page you will get a toolbar at the top with the option to restore all thumbnails

image

Removing an entry from the blacklist

In newer versions of Google Chrome you will find the black in the preferences file themselves. This is located under “%LocalAppData%\Chromium\User Data\Default\Preferences”. There are a section “most_visited_blacklist” to configure the entries. But till yet I does not investigate the logic behind the notation there.

It seems that in older Version was an stand alone file for that (“%LocalAppData%\Chromium\User Data\Default\most_visited_blacklist”).


Thursday, December 08, 2011 #

Problem

Jenkins dashboard shows following simian analysis:

But after clicking one item I get:

Solution

My simian call was:

.\tools\Simian\bin\simian-2.3.33.exe ./src/**/*.cs -formatter=xml:.\bin\Simian.Result.xml -threshold=10 -excludes="**/*.Designer.cs" -excludes="**/*Fixture*.cs" -excludes="**/*.g.cs" -excludes="**/*.xaml.cs" -failOnDuplication-

but the folder prefix (‘./’) for current folder in front of (‘src/**/*.cs’)  is wrong.

Deleting the unnecessary chars lets the system work:


Monday, December 05, 2011 #

Last week I get the information directly from Microsoft, that at build machines SDKs must be installed to guarantee that MSBuild works well in some circumstances.

We have the problem, that a self-containing build should include all necessary build artifacts – particularly Silverlight stuff. I tried to encapsulate the special steps in own targets and a build was finally possible (see my former posts). But at local machines without installed Silverlight stuff it gives problems for problems. Because reason of time finally I decide to go the Microsoft way – they break my volition Winking smile

Only one thing I left in my DevTree: the WebApplication target. This stuff is not included in the Silverlight SDK – no idea where it comes from. To avoid the build breaks on our continuous integration server I reference this target in my DevTree self.

These lines:

  <ImportGroup Condition=" '$(Configuration)' == 'Debug' ">
    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
  </ImportGroup>
  <ImportGroup Condition=" '$(Configuration)' != 'Debug' ">
    <!-- leider nicht von Visual Studio akzeptiert -->
    <Import Project="..\..\..\tools\WebApplications\Microsoft.WebApplication.targets" />
    <!-- -->
  </ImportGroup>

Friday, November 25, 2011 #

Problem

this code does not work

Type t = typeof(ESRI.ArcGIS.Framework.AppRefClass);
System.Object obj = Activator.CreateInstance(t);

but yet this code

Type t = Type.GetTypeFromCLSID(typeof(ESRI.ArcGIS.Framework.AppRefClass).GUID);
System.Object obj = Activator.CreateInstance(t);

Reason

In the first variant the runtime tries to cast to AppRefClass . This is not possible.

And in the second one, the runtime does not knows anything about AppRefClass. So it leave it as IUnknown.

 

(originally communicated by my co-worker Ralf)


Sunday, November 20, 2011 #

Why such constructs are included in the csproj-Files?

<CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>

So it every projects needs some manual steps to clean the project file so the solution could be build on a continuous integration server. That annoying!

And also in a Visual Studio mixed editions team that’s too specific for the ultimate edition.

As good as Visual Studio in most cases is, sometimes it is really far away from professional coding fundamentals and best practices. Sad smile


Thursday, November 10, 2011 #

Problem

Normally I try to have my continuous integration as most a possible toolset free to ensure that no local stuff could have an impact to my build.

My Silverlight app references a special compile target in a folder outside my developer tree:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

So I copied the stuff from this folder to a local one and changed the call to this target in my csproj:

<Import Project="..\..\..\tools\WebApplications\Microsoft.WebApplication.targets" />

And now Visual Studio Conversion Wizard welcomes my with this:

image

Solution

Regardless of which line I write – this conversion comes back again and again, if the line has another form than

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

So it seems that there is no simple way to change this behaviour. Sad smile

Workaraound

I must accept, that this line must be in the csproj and to run the build the toolset must be copied to the build server at the correct location.

So go to your development machine where Visual Studio is installed and copy the folder “C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications” to your build server at the equivalent location.

 

Xmas wishes to Microsoft:

Please provide technologies to let us developers bundle all needed stuff for a project in one developer tree. It should be possible that one checkout starts us up! No additional installations regardless whether it is a developing machine or dedicated build or continuous integration server.

Silverlight is only one example, code analysis configurations could also be terrible and much more …


Tuesday, November 08, 2011 #

Problem

Normally PostSharp runs fine on unattended build servers. So on our global Jenkins continuous integration server PostSharp does the job.

But on my local TeamCity continuous integration server I got the following error:

POSTSHARP error PS0127: The aspect 'EsriDE.Commons.Logging.Aop.PostSharp.LoggingAspectAttribute' uses non-licensed features (Basic Features). Please visit http://www.sharpcrafters.com/ to acquire a license of PostSharp. 
POSTSHARP error PS0154: Information regarding the previous message: the installed user license is: "". 
POSTSHARP error PS0060: The processing of module "EsriDE.Maintenance.LoginExtension.dll" was not successful. 

Okay – so install the license via a target in the developer tree. Like described in

Configuring PostSharp - Creating a file PostSharp.Custom.targets or Deploying License Keys for a Team

This throws a new error:

C:\Program Files (x86)\TeamCity\buildAgent\work\bf9b0bb7766c4536\lib\Nuget-Packages\PostSharp.2.1.5.1\tools\PostSharp.targets(173, 5): Property 'PostSharpLicenseKey' is deprecated.

and indeed: this option was discontinued

Announcing PostSharp 2.1 CTP 2 (see section “License Management”)

Solution

Note to self: RTFM Winking smile

Deploying PostSharp into a Source Repository - Adding PostSharp to your project using PostSharp HQ

Activate the license you got with the one of the first mails from SharpCrafters and everything works like expected.


Problem

Our global Jenkins continuous integration server throws this error during compile step. My local TeamCity continuous integration server runs fine. What is the difference.

Background

I integrate some static code analysis steps via MSBuild-targets in the csproj files.

To allow a fast developing without a code analysis for ever compiling I bound these targets only to RELEASE-configuration.

With the MSBuild element <ImportGroup> only one condition must be specified. So my construct was:

<ImportGroup Condition="'$(Configuration)'=='Release'">
    <Import Project="..\..\..\tools\Fxcop\EsriDE.FxCop.targets" />
    <Import Project="..\..\..\tools\StyleCop\StyleCop.targets" />
</ImportGroup>

That works fine in Visual Studio and TeamCity.

But Jenkins allows to specify the MSBuild version:

image

Because my target framework is .NET 3.5 I decide to choose the entry .NETv3.5-x86.

And this was the failure. The MSBuild element <ImportGroup> is new in .NET 4.0

Solution

With the following options everything runs fine:

image

 

BTW: Maybe that some combinations of MSBuild version and toolsversion switch could also fix this error.


Monday, November 07, 2011 #

Problem

A continuous integration server should only have a minimal toolset installed. This ensures that no unwanted libraries could affect the build and other steps.

Clearly that with this slogan also StyleCop should not be installed to the CI server. But we wanna have this analysis as an part of the whole build.

Solution

Prerequisites

First at all we need the necessary files from StyleCop (the core assemblies and the target).

The easiest way is to download the MSI of StyleCop, install the software and copy the relevant artifacts to a tools folder in our developer tree.

For a default installation you will find the assemblies under the program files folder and the target file under the MSBuild folder. You could copy all together to one folder.

Now deinstall the software to ensure, that your project local environment works (no impact from installed stuff).

Configure your environment

To run StyleCop from the target file it must be edited. Change the third line

from

<UsingTask AssemblyFile="$(ProgramFiles)\StyleCop 4.6\StyleCop.dll" TaskName="StyleCopTask"/>

to

<UsingTask AssemblyFile="StyleCop.dll" TaskName="StyleCopTask"/>

Configure your csproj files

In the last step we bore up all csproj files of our solution. Next to the c#-compile target we call the StyleCop target:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\tools\StyleCop\StyleCop.targets" />

Take care to adjust the correct relativ folder from csproj- to target- file.


Problem

When using xUnit and constructs like Debug.WriteLine the DbgView-tool does not show the written output anymore.

Solution

Add a new Listener – for example:

Debug.Listeners.Add(new DefaultTraceListener());

Friday, November 04, 2011 #

Problem

I must go back to an older package version (from 1.1.0.0 to 1.0.0.0) but the Package Manager Console does not allow this.

With the command

Update-Package EsriDE.Commons.System.Utils -Version 1.0.0.0

I got the error:

Update-Package : Already referencing a newer version of 'EsriDE.Commons.System.Utils'.

Solution

Don’t worry. You could uninstall the package

Uninstall-Package EsriDE.Commons.System.Utils -Version 1.1.0.0

and install the older one instead.

Install-Package EsriDE.Commons.System.Utils -Version 1.0.0.0

Tuesday, November 01, 2011 #

As an GWB-influencer I had the chance to review SmartAssembly.

Because obfuscation is an important part in protecting intellectual property this review chance was a good start for this. The first few clicks show that not only obfuscation could be made with SmartAssembly but also some other very interesting things.

The complete review could be read here: GWB-Review SmartAssembly


Friday, October 28, 2011 #

Motivation

During programming suddenly this error (“Failure has occurred while loading a type”) was thrown by accessing a artifact of a referenced library.

In such cases I take the assembly fusion logger fuslogvw to search for problems of loading assemblies. Sometimes an old version from a not expected folder is binded. But all bindings were correct.

Problem

After several hour I got the right hint. Because the assembly is a COM+ one, there are some registration things in die background – and I don’t mean the regsrv-stuff!

And there was one step which access the GUID of the type under “HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4E83E98D-0D8F-4949-8436-0F001CFE5039}”.

Reason for the problem

Than I remembered, that I started developing of the COM+ library as a normal user – and during runtime I got two errors regarding the accessing of the following keys:

System.EnterpriseServices.RegistrationException : You must have administrative credentials to perform this task. Contact your system administrator for assistance.
----> System.EnterpriseServices.RegistrationException : Failed to register assembly 'ErpUnlinkedObjectsRestSoe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789abcdef'.
----> System.UnauthorizedAccessException : Access to the registry key 'HKEY_CLASSES_ROOT\ErpUnlinkedObjectsRestSoe' is denied.

I created this key with administrative credentials:

image

and set the permissions for normal users:

image

image

Because after each run the key is deleted I decided to set a deny for delete. So the key stays over the following runs.

The following error

System.EnterpriseServices.RegistrationException : You must have administrative credentials to perform this task. Contact your system administrator for assistance.
----> System.EnterpriseServices.RegistrationException : Failed to register assembly 'ErpUnlinkedObjectsRestSoe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789abcdef'.
----> System.UnauthorizedAccessException : Access to the registry key 'HKEY_CLASSES_ROOT\CLSID\{4E83E98D-0D8F-4949-8436-0F001CFE5039}' is denied.

I resolved like above.

And these keys were now the basic evil.

Solution

I deleted the key and started my Visual Studio with administrative credentials to run the code.