Skip to content

Support NLog.config from UNC path #5666

@snakefoot

Description

@snakefoot

Seems NET9 changes the System.AppContext.BaseDirectory and AppDomain.CurrentDomain.BaseDirectory to UNC paths:

  • \\?\UNC\rwells\very\special\bin\Development\net9.0\NLog.config
  • \\?\C:\Temp\NLog.config

These paths cannot be handled by Uri-object, which is used inside XmlReader for loading NLog.config-file. Uri throws System.UriFormatException - Invalid URI: The hostname could not be parsed..

Possible work-around is to manually read the contents of the NLog.config-file, and give the stream/string to the XmlReader (Only apply work-around when path starts with \\?\)

See also: https://stackoverflow.com/q/79208703/193178

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions