.NET Resources Structure Viewer
A VS Code extension for inspecting the binary structure of .NET .resources files.
These are the files compiled from .resx (you'll find them under obj/), or produced by resgen, ResourceWriter, or PreserializedResourceWriter. Open any *.resources file and the viewer appears in place of the text editor.
Highlights
- No .NET required. The extension parses the binary format itself and never calls into the .NET runtime.
- Safe by design. Nothing is deserialized, so even BinaryFormatter payloads are inspected without being executed.
- Live reload. The view refreshes automatically when the file changes on disk (for example, after a rebuild).
Installation
Search for .NET Resources Structure Viewer in the VS Code Extensions view, or run:
code --install-extension vtzy137.dotnet-resources-viewer
Usage
- Open any
*.resources file. The viewer opens automatically.
- To open a file with a different extension, right-click it in the Explorer (or use the Command Palette) and run .NET Resources: Open with .NET Resources Viewer.
- To see the raw file instead, click Open as text in the viewer, or right-click the editor tab → Reopen Editor With... → Text Editor.
Features
The viewer is organized into five tabs.
Overview
File size, resource count, user type count, format version (V1/V2), reader type, data section offset, and a name hash check.
Resources
A table of every resource with its name, type, size, offset, and value.
- Filter by name or value, filter by type, sort by column, and navigate with the ↑/↓ keys.
- Select a resource to see its details:
- Type code, name record and data record offsets.
- The hash stored in the file compared with a freshly computed hash.
- The full value.
- Image preview for PNG, BMP, GIF, JPEG, ICO, CUR, WebP, and SVG. Works for
byte[] / Stream resources and for System.Drawing.Bitmap / Icon serialized with BinaryFormatter.
- BinaryFormatter (MS-NRBF) payload analysis: class name, assembly, and member list.
- Hex dump of the data record and name record.
- Copy and export: copy the name or value, or export the value, image, or raw record to a file.
Every field of the ResourceManager header and the RuntimeResourceSet header, with its offset.
Types
The file's type table, plus resource counts per type.
Layout
A map of every region in the file (header, type table, padding, hashes, positions, name section, data section). Click a region to view its hex.
| Format |
Supported content |
RuntimeResourceSet V2 (ResourceTypeCode) |
Null, String, Boolean, Char, Byte, SByte, Int16/32/64, UInt16/32/64, Single, Double, Decimal, DateTime (ToBinary, including Kind), TimeSpan, ByteArray, Stream, user types (>= 0x40) |
| RuntimeResourceSet V1 (index into the type table) |
Primitive types by type name; -1 = null; anything else is treated as an object |
System.Resources.Extensions.DeserializingResourceReader |
BinaryFormatter, TypeConverterByteArray, TypeConverterString, ActivatorStream |
For reference, this is the layout the viewer decodes:
ResourceManager header
Int32 MagicNumber 0xBEEFCACE
Int32 ResMgrHeaderVersion 1
Int32 NumBytesToSkip
String ReaderType System.Resources.ResourceReader, mscorlib, ...
String ResourceSetType System.Resources.RuntimeResourceSet
RuntimeResourceSet header
Int32 Version 1 | 2
Int32 NumResources N
Int32 NumTypes M
String TypeNames[M]
byte Padding[0..7] "PAD" up to a multiple of 8
Int32 NameHashes[N] FastResourceComparer.HashFunction, sorted ascending
Int32 NamePositions[N] relative to the Name section
Int32 DataSectionOffset absolute offset
Name section (N records)
7-bit ByteLength
UTF-16LE Name
Int32 DataOffset relative to the Data section
Data section
7-bit TypeCode (V2) | TypeIndex (V1)
... Value
Strings use the BinaryWriter.Write(string) encoding: a 7-bit encoded byte length followed by UTF-8 bytes.
Contributing
Build from source
npm install
npm run package # produces dotnet-resources-viewer.vsix
code --install-extension dotnet-resources-viewer.vsix
You can also install the .vsix from VS Code: Extensions → ... → Install from VSIX...
To debug, open this folder in VS Code and press F5.
Run the tests
The test suite compares the parser's output against the real .NET ResourceReader, so it requires the .NET SDK:
dotnet run --project test/generator -- test/fixtures
npm test
License
MIT