Daily Archives: 2013-03-02


Solution for “Task failed because sgen.exe was not found”

xml_objectTrying to compile a C# project with some Web Referenes via the SharpDevelop IDE I take an error message, that the “Compilation task failed because sgen.exe was not found”.

Sgen.exe is a XML Serializer Generator tool which creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types. The Sgen.exe tool generate those assemblies in advance and these assemblies can then be deployed with the application. The XML Serializer Generator can also improve the performance of clients that use XML Web service proxies to communicate with servers because the serialization process will not incur a performance hit when the type is loaded the first time. These generated assemblies cannot be used on the server side of a Web service. This tool is only for Web service clients and manual serialization scenarios.

By default, the project properties set the “Generate serialization assembly” to “Auto”. And this generate the error when going to build a project that the system found the need of Serializer Generator usage, and the tool not found.

One simply and fast solution is to set the “Generate serialization assembly” property to “Off”, but this is not a good idea in general because when the XML Serializer Generator is not used, an XmlSerializer generates serialization code and a serialization assembly for each type every time an application is run.

The sgen tool does not installed with the .net framework, but with the only with the MS SDK for Windows 7 and .NET Framework, so, the fastest and lightweight sollution available, without installing the MS Whindows SDK, is it to download the SDK in iso format, open the iso images with an archive manager wich support iso files (such as the open source 7Zip) and extract the sgen tool following the steps above:

  • Firstly extract the SDKISOFILE.isoSetupWinSDKNetFxToolscab1.cab
  • Open the extracted cab1.cab and extract the files FL_sgen_exe_94980_94980_x86_ln and FL_sgen_exe_config_x86
  • Rename the first file to sgen.exe and to sgen.exe.config the other.
  • Put these files to C:WINDOWSMicrosoft.NETFrameworkv3.5
  • And you finished! Now try to compile your project 😉

 
——
*in my example I use the .net framework 3.5, for another version you must download the appropriate SDK and put the files at the C:WINDOWSMicrosoft.NETFrameworkvX.X you target.


HTML5 localStorage exploit at Chrome, Safari, Opera & IE

html5-local-storageCurrent versions of Chrome, Safari, Opera and IE they implement HTML5 localStorage quite unsophisticated, ignoring the affiliated sites (and subdomains) storage limit as provided by the specification. So, by setup perpetually subdomains exploiting this weakness, and with some tricky code, a site can fill up completely the user’s hard disk space.

Feross.org, create proof-of-concept web site, the FillDisk.com and make the code they used available at the GitHub, also with submitting bug reports to all exploitable browsers dev teams.

This exploit can affect systems with Chrome 25, Safari 6, Opera 12 & IE 10 and prior versions of these browsers with localStorage feature.

The only bullet-proof major browser is the Firefox, because of smarter and more in line with the standards implementation, of the localStorage feature.