Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Guid From String Analyzer
Guid From String Analyzer

Guid From String Analyzer

Nico Rieck

|
274 installs
| (2) | Free
Analyzes Guid constructor calls using inefficient strings instead of integers
Download

GuidFromStringAnalyzer

Overview

GuidFromStringAnalyzer is a small Roslyn analyzer that detects instantiations of System.Guid with a string literal:

new Guid("26B5DB35-C401-4DE3-B3D8-203FF9A0CA91");

and provides the Construct from integers fix-it to change them to the more efficient constructor using integers: ​

new Guid(0x26B5DB35, 0xC401, 0x4DE3, 0xB3, 0xD8, 0x20, 0x3F, 0xF9, 0xA0, 0xCA, 0x91);

​ The latter is directly embedded into the resulting assembly as a simple byte-array and requires no run-time parsing of the GUID string. Roslyn currently does not optimize the string literals away on its own, see the relevant issue. ​

Installing

​ Download the GuidFromStringAnalyzer Visual Studio extension from the VS Marketplace. ​

License

​ Code licensed under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft