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,861 other subscribers

Archive for February, 2014

.NET/C#: When XmlSerializer throws “Unable to generate a temporary class (result=1).” / “error CS2001”

Posted by jpluimers on 2014/02/06

A while ago, I had this error when running an application on a hardened server:

Unhandled Exception:System.InvalidOperationException:
Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\windows\TEMP\0hocq2nq.0.cs' could not be found  error CS2008: No inputs specified
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace, String location)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, Type[] extraTypes)

Usually I’m not the first with strange errors, but searching for “Unhandled Exception:System.InvalidOperationException: Unable to generate a temporary class” didn’t get many results.

This was a program running from SSIS under a non-system domain account with very little access.

My first guess was the right now: the XmlSerializer wants to generate a temporary C# file, then compile it into a temporary assembly. Since it cannot generate the C# file because the account does not have access to %windir\TEMP%, the compiler cannot find the (not generated) C# file.

After a few tries, I searched for XmlSerializer without GenerateAssembly, where the first hit ended at Changing where XmlSerializer Outputs Temporary Assemblies – Scott Hanselman.

That post indicated I should try looking for tempFilesLocation in the XmlSerializer context.

That got me these posts: Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

.NET/C#/VB.NET – Default value for generics (via: Stack Overflow)

Posted by jpluimers on 2014/02/05

Looking for the pesky little differences between C# and VB.NET, I stumbled over this nice question by Micah Martin on default values for generics in VB.NET as compared to C#. Actually there were 3 questions, so I did a bit of post-editing:

How do I create the default for a generic in VB.NET? in C# I can call:
T variable = default(T);

  1. How do I do this in VB?
  2. If this just returns null (C#) or nothing (VB.NET) then what happens to value types?
  3. Is there a way to specify for a custom type what the default value is? For instance what if I want the default value to be the equivalent to calling a parameterless constructor on my class.

User Konrad Rudolph – Stack Overflow. promptly gave three answers:

Question 1:

Dim variable As T ‘ or ‘ Dim variable As T = Nothing ‘ or ‘ Dim variable As New T() Notice that the latter only works if you specifiy either the New or the Structure constraint for the generic type.

Question 2:

For value types all members of the struct are “nulled” out, i.e. all reference type members are set to null (Nothing) and all value types are in turn nulled out. And no, since string is a reference type, it does not result in "" for strings as suggested in the other answer.

Question 3:

No, there’s no way to specify this. There are some threads about this on Stack Overflow already, e.g. here. Jon has posted an excellent explanation why this is.

–jeroen

via: c# – Default value for generics – Stack Overflow.

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 7.0, VB.NET 7.1, VB.NET 8.0, VB.NET 9.0 | Leave a Comment »

Contact — Support — WordPress.com

Posted by jpluimers on 2014/02/05

Paying customers can use Contact — Support — WordPress.com.

Sometimes they respond sooner than on a regular forum post. Not often though.

–jeroen

Posted in Power User, SocialMedia, WordPress | Leave a Comment »

How can you force SQL Server 2008 R2 to accept an ORDER BY on a column that is not part of a table? – Stack Overflow

Posted by jpluimers on 2014/02/04

I’m sure there are many organizations that only upgrade things until they absolutely have to (i.e. long after mainstream support has ended, often even after extended support has ended). This was from last year: upgrading away from SQL Server 2000 just before extended support ended. While migrating a bunch of applications we inherited from SQL Server 2000 to SQL Server 2008 R2, I came across an ORDER BY style that failed. The queries are generated by an kind of SQL generation layer, so not easy to change. the main questions were:

  • is it possible to force SQL Server 2008 R2 to accept this kind of queries and perform the SQL Server 2000 behaviour (so we can fix the SQL generation layer, and perform regression on it)?
  • why would SQL Server 2000 happily accept this kind of queries?

First two possible fixes, then the full stack overflow question I posted about the migration.

Aaron Bertrand very quickly posted two fixes, which I paraphrased and extended. Read the rest of this entry »

Posted in Database Development, Development, SQL Server, SQL Server 2000, SQL Server 2008 R2 | Leave a Comment »

Why the Heck is Git so Hard? | Probably Done Before

Posted by jpluimers on 2014/02/04

Why the Heck is Git so Hard? | Probably Done Before is wonderful, especially as it points to workspace • Git Cheatsheet • NDP Software.

And I really like this hacker news comment on it: Read the rest of this entry »

Posted in Development, DVCS - Distributed Version Control, git, Source Code Management | 2 Comments »

Display Windows 8.x Edition & Build Version on Your Desktop (via: Team Windows 8)

Posted by jpluimers on 2014/02/04

Display Windows 8 Edition & Build Version on Your Desktop | Team Windows 8:

Two keys needed: one HKCU one HKLM. You need to be Administrative user with a CUA token to install the second one.


Windows Registry Editor Version 5.00
;http://teamwindows8.com/2013/03/display-windows-8-edition-build-version-on-your-desktop/
[HKEY_CURRENT_USER\Control Panel\Desktop]
"PaintDesktopVersion"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows]
"DisplayVersion"=dword:00000001

–jeroen

Posted in Power User, Windows, Windows 8 | Leave a Comment »

OS X menu keyboard shortcuts: Ctrl-F2 and Shift-Command-?

Posted by jpluimers on 2014/02/04

So I don’t forget:

Often, Ctrl-F2 (^-F2) fails to show the menu, but ⇧ ⌘ ? (shift+command+/) works all the time.

You can navigate the menus in the menu bar without using a mouse or trackpad. To put the focus in the menu bar, press Control-F2 (Fn-Control-F2 on portable keyboards). Then use the key combinations listed below.

Left Arrow and Right Arrow Move from menu to menu
Return Open a selected menu
Up Arrow and Down Arrow Move to menu items in the selected menu
Type the menu item’s name Jump to a menu item in the selected menu
Return Select a menu item

–jeroen

via:

Posted in Apple, Keyboards and Keyboard Shortcuts, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User | Leave a Comment »

Ready to cast: Chromecast now open to developers with the Google Cast SDK #interesting #fun (via: Chromium Blog)

Posted by jpluimers on 2014/02/03

With a more decent internet connection during our trip, it is time to catch up on some recent news.

The first that caught my eye was that the Chromecast API now is open to all developers.

Developer information is available through Casting Your Content to the Big Screen – Google Cast — Google Developers.

You need to pay a one-time USD 5 fee per development account (how’s that Apple?) for the Google Cast SDK Developer Console.

After that, you will have to register your Chromecast device(s) and custom or styled media receiver apps.

Interesting. Fun.

I hope this can be combined with the new Smart Mobile Studio 2.0 release or the Delphi for Android support.

Will get back on that as soon as I’m back home.

Resources:

More links:

–jeroen

via: Chromium Blog: Ready to cast: Chromecast now open to developers with the Google Cast SDK.

Posted in Chrome, Chromecast, Delphi, Delphi XE5, Development, Google, JavaScript/ECMAScript, Pascal, Power User, Scripting, Smart Mobile Studio, Software Development | 1 Comment »

To force-quit Mac Applications: the Mac equivalent of “Ctrl Alt Delete” (via: eHow.com): Option-Command-Esc

Posted by jpluimers on 2014/02/03

Once every while, a full screen app on your Mac hangs, and there is no way to Command-Tab to another application.

PC addicts then press Ctrl+Alt+Del, to either get to the Task Manager, or to logoff/reboot.

For a Mac, there are two:

  1. Force Quit Read the rest of this entry »

Posted in Apple, Keyboards and Keyboard Shortcuts, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook-Air, MacBook-Pro, OS X 10.8 Mountain Lion, Power User, Windows, Windows 7, Windows 8, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP | Leave a Comment »

Hanselman’s Newsletter of Wonderful Things: December 17th, 2013 – Scott Hanselman

Posted by jpluimers on 2014/02/03

Always an interesting read, and usually posted to his blog a while after the email blast gets out.

There is too much information to fully re-post here, so here is an abstract of the entries I already had benefits from, or have a high interest in:

(BTW: don’t you love the that the bug report about WordPress.com adding backslashes in the “Press This” functionality still got no official WordPress response after 3 months?)

–jeroen

via: Hanselman’s Newsletter of Wonderful Things: December 17th, 2013 – Scott Hanselman.

Posted in Development, Power User, Software Development, Windows | Leave a Comment »