Skip to content

Fix: Handle empty Assembly.Location in single-file published apps - #221

Merged
albertospelta merged 2 commits into
sql-bi:masterfrom
gronnerup:fix/single-file-assembly-location
Apr 16, 2026
Merged

Fix: Handle empty Assembly.Location in single-file published apps#221
albertospelta merged 2 commits into
sql-bi:masterfrom
gronnerup:fix/single-file-assembly-location

Conversation

@gronnerup

@gronnerup gronnerup commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Problem

Two places in the codebase call FileVersionInfo.GetVersionInfo(assembly.Location):

  • Util.GetExtractorInfo() in Dax.Model.Extractor
  • Model() constructor in Dax.Metadata

Both throw an ArgumentException when the consuming application is published as a .NET single-file executable. In single-file mode, managed assemblies are loaded from memory and Assembly.Location returns an empty string, causing Path.GetFullPath("") to fail.

This makes it impossible to use TomExtractor.GetDaxModel() from a single-file app without setting IncludeAllContentForSelfExtract=true, which forces all bundled content to be extracted to a temp directory on disk. This is defeating much of the benefit of single-file publishing.

Fix

Use AssemblyInformationalVersionAttribute for version retrieval. Standardize on AssemblyInformationalVersionAttribute instead of FileVersionInfo, which requires Assembly.Location. This provides a single consistent approach across all deployment types including single-file published apps.

Files changed:

  • src/Dax.Model.Extractor/Util.csGetExtractorInfo()
  • src/Dax.Metadata/Model.csModel() constructor

Impact

No behavior change for existing consumers.

Standardize on AssemblyInformationalVersionAttribute instead of
FileVersionInfo, which requires Assembly.Location. This provides
a single consistent approach across all deployment types including
single-file published apps. Also reverts accidental tabs-to-spaces
indentation change in Model.cs.
@albertospelta
albertospelta merged commit f3a1277 into sql-bi:master Apr 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants