The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘C#’ Category

Easy way to generate “System.InvalidOperationException: Nullable object must have a value.”

Posted by jpluimers on 2016/07/07

Easy way to generate “System.InvalidOperationException: Nullable object must have a value.”.


using System;
public class Test
{
public static void Main()
{
int? nullableInt = null;
int nowInt = (int)nullableInt;
}
}

–jeroen

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »

Writing tests for http / https request: Postman, SoapUI, Advanced REST client.

Posted by jpluimers on 2016/06/21

I’m using these Chrome Extensions for most of the http / https call mockups, and after that put them in SoapUI (which despite the name also does REST and has come a long way sinceSource: SoupUI – as sometimes that is the only thing that works):

You can get both Postman versions through GetPostman.com as well.

–jeroen

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 3.0, C# 4.0, C# 5.0, Chrome, Communications Development, Development, Google, HTTP, Internet protocol suite, Power User, REST, Software Development, TCP | 1 Comment »

Did you know… How to change the build order for your solution? – #333 – Sara Ford’s Weblog – Site Home – MSDN Blogs

Posted by jpluimers on 2016/06/08

Boy I wish I had known this earlier. Like years ago…

In the Solution Explorer:

  1. Right Click Project
  2. Project Build Oder.
  3. Use the dialog to change the build order

It is next to the “Project Dependencies” in this image from Sara Ford:

Sara Ford: change

Sara Ford: change “Project Build Order”

In the resulting dialog, you can change the build order within your solution.

This can be very useful when – for various reasons – you cannot have Project Level dependencies for an assembly, but have to have Assembly Reference dependencies for individual assemblies.

At a client I bumped into this, and this dialog was a life saver for us.

Others have used it because some Visual Studio versions miscalculate the dependencies.

–jeroen

Did you know… How to change the build order for your solution? – #333 – Sara Ford’s Weblog – Site Home – MSDN Blogs.

Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development, Visual Studio 11, Visual Studio 2008, Visual Studio 2010, Visual Studio 2012, Visual Studio 2013, Visual Studio and tools | Leave a Comment »

Microsoft opened the source code of Xamarin.Forms. We couldn’t miss a chance to check it with PVS-Studio

Posted by jpluimers on 2016/05/31

For my link list as one day I will surely need a tool like this:

The project was checked using the PVS-Studio static code analyzer.

Source: Microsoft opened the source code of Xamarin.Forms. We couldn’t miss a chance to check it with PVS-Studio

Posted in .NET, C#, Development, Software Development, Static Code Analysis | Leave a Comment »

Support of import in xsd.exe – Jose Luis Calvo Salanova – Site Home – MSDN Blogs

Posted by jpluimers on 2016/04/20

I tend to forget this: xsd.exe can resolve xs:include, but not xs:import. When using xs:import it will complain about missing types.

Simple solution: reference all imported XSDs (but not included XSDs) on the same command-line:

I was trying to create a C# class with xsd.exe from an schema that imports others schemas like that xsd.exe /c schema.xsd and it fails miserably reporting an error like “The datatype ‘xxx’ is missing.”. Basically xsd.exe doesn’t resolve the schemaLocation attribute.

Dare Obasanjo’s article addresses the problem, and Scott Hanselman had the same problem -and solved it-.

The solution isn’t very nice, but at least it’s simple. You have to tell xsd.exe all the schema referenced, xsd.exe /c schema.xsd importedSchema1.xsd importedSchema2.xsd

Be aware that the C# filename is sometimes generated from all XSD filenames on the command-line (I’ve noticed this when the import is specified before the actual XSD file, if the import is at the end, the name of the import is used.

If my memory serves me right, older versions of XSD.exe could not resolve unix-style relative paths on the command-line, but newer versions do.

–jeroen

via: Support of import in xsd.exe – Jose Luis Calvo Salanova – Site Home – MSDN Blogs.

Posted in .NET, C#, Development, Software Development, XML/XSD, XSD | Leave a Comment »

Visual Studio 2015 Frequently Asked Questions – install size

Posted by jpluimers on 2016/04/14

Visual Studio is a pretty big product and will take over 30GB of disk space after installation

Source: Visual Studio Frequently Asked Questions

LOL. It’s about half the size of recent Delphi versions.

–jeroen

Posted in .NET, .NET 4.0, .NET 4.5, C#, C# 5.0, C# 6 (Roslyn), Delphi, Delphi 10 Seattle, Delphi XE8, Development, Software Development, VB.NET, Visual Studio 2015, Visual Studio and tools, Xamarin Studio | 4 Comments »

License for MICROSOFT VISUAL STUDIO COMMUNITY 2015 (which includes Xamarin use)

Posted by jpluimers on 2016/04/07

Wow, Microsoft has come a long way:

MICROSOFT VISUAL STUDIO COMMUNITY 2015


These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. They apply to the software named above. The terms also apply to any Microsoft services or updates for the software, except to the extent those have different terms.


IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW.

  1. INSTALLATION AND USE RIGHTS.
    1. Individual license. If you are an individual working on your own applications to sell or for any other purpose, you may use the software to develop and test those applications.
    2. Organization licenses. If you are an organization, your users may use the software as follows:
      • Any number of your users may use the software to develop and test your applications released under Open Source Initiative (OSI) approved open source software licenses.
      • Any number of your users may use the software to develop and test extensions to Visual Studio.
      • Any number of your users may use the software to develop and test your applications as part of online or in person classroom training and education, or for performing academic research.
      • If none of the above apply, and you are also not an enterprise (defined below), then up to 5 of your individual users can use the software concurrently to develop and test your applications.
      • If you are an enterprise, your employees and contractors may not use the software to develop or test your applications, except for open source and education purposes as permitted above. An “enterprise” is any organization and its affiliates who collectively have either (a) more than 250 PCs or users or (b) more than one million US dollars (or the equivalent in other currencies) in annual revenues, and “affiliates” means those entities that control (via majority ownership), are controlled by, or are under common control with an organization.
    3. Demo use. The uses permitted above include use of the software in demonstrating your applications.

The license continues, but the above are the most important aspect to verify if you can use Visual Studio 2015 under that license.

Source: MICROSOFT VISUAL STUDIO COMMUNITY 2015

Via Danial Rail and Mason Wheeler in this thread.

–jeroen

Posted in .NET, C#, Development, Software Development, VB.NET, Visual Studio 2015, Visual Studio and tools | 1 Comment »

Anders Live | Build 2016 | Channel 9 – on Turbo Pascal, Delphi, C# and TypeScript

Posted by jpluimers on 2016/04/06

Anders Live - Build 2016 - Channel 9 Stage C907 - Speakers: Anders Hejlsberg, Seth Juarez

Anders Live – Build 2016 – Channel 9 Stage C907 – Speakers: Anders Hejlsberg, Seth Juarez

Anders explaining about being a pragmatist ever since he started working on the Turbo Pascal predecessor in 1981. It’s been a long way to TypeScript and beyond (:

Lot’s of interesting tidbits about the future of TypeScript and how it relates to other languages.

Source: Anders Live | Build 2016 | Channel 9

Direct URLs:

–jeroen

PS:

The Turbo Pascal predecessors were called Blue Link Software PascalCompas Pascal and Poly Pascal as I learned last year while teaching a workshop for DAPUG in Denmark when I bumped into some people working with Anders while he still lived there a long time ago. Later I researched the above links.

 

Posted in .NET, C#, Delphi, Development, History, Pascal, Software Development, Turbo Pascal | 1 Comment »

NHibernate, LINQ, Oracle and the placement of Take: avoid “Specified method is not supported.”

Posted by jpluimers on 2016/03/22

Even though as of 12c R1, Oracle supports a row limiting clause, NHibernate 4.2 with Oracle.DataAccess.dll 2.112.3.0 does not support that.

When you let it generate the SQL for a LINQ Take call to limit the number of results, you get an exception like this (full exception and stack trace are below):

System.NotSupportedException was unhandled by user code
  HResult=-2146233067
  Message=Specified method is not supported.

The place where you Take is important, as this does fail:
Read the rest of this entry »

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET ORM, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Database Development, Development, NHibernate, OracleDB, Software Development | Leave a Comment »

Reminder to self: app.config and “ORA-12154: TNS:could not resolve the connect identifier specified”

Posted by jpluimers on 2016/03/17

When you have one app.config for your whole set of DTAP environments (develop/test/acceptance production), every once in a while you get this error:

ORA-12154: TNS:could not resolve the connect identifier specified

For this particular setup, it means the replacement of parameters in the app.config with actual values from the DTAP went wrong (or was missing). For that we’ve some steps in both the PreBuildEvent and PostBuildEvent of the .csproj file:

PreBuildEvent:

del "$(ProjectDir)$(TargetFileName).config"
copy "$(ProjectDir)app.config" "$(ProjectDir)$(TargetFileName).config"

PostBuildEvent:

powershell -noprofile -file Replace-Parameter.ps1 -Path "$(TargetDir)$(TargetFileName).config"

The PreBuildEvent looks like it is not needed, but sometimes Visual Studio forgets to perform the copy action.

–jeroen

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET ORM, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Database Development, Development, NHibernate, OracleDB, Software Development | Leave a Comment »