Open
Description
NuGet Product Used
MSBuild.exe
Product Version
All
Worked before?
No response
Impact
It bothers me. A fix would be nice
Repro Steps & Context
When the code in SettingsFile
attempts to perform I/O tasks, it does so in a utility method, ExecuteSynchronized. This method catches several exception types and re-throws it with a new message. The current four messages include the path to the file that was attempted to be read but does not include the original exception method.
<data name="ShowError_ConfigInvalidOperation" xml:space="preserve">
<value>NuGet.Config is malformed. Path: '{0}'.</value>
</data>
<data name="ShowError_ConfigInvalidXml" xml:space="preserve">
<value>NuGet.Config is not valid XML. Path: '{0}'.</value>
</data>
<data name="ShowError_ConfigUnauthorizedAccess" xml:space="preserve">
<value>Failed to read NuGet.Config due to unauthorized access. Path: '{0}'.</value>
</data>
<data name="Unknown_Config_Exception" xml:space="preserve">
<value>Unexpected failure reading NuGet.Config. Path: '{0}'.</value>
</data>
The code is passing the message, the string resource just doesn't include it in the new exception.
try
{
ioOperation();
}
catch (InvalidOperationException e)
{
throw new NuGetConfigurationException(
string.Format(CultureInfo.CurrentCulture, Resources.ShowError_ConfigInvalidOperation, ConfigFilePath, e.Message), e);
}
catch (UnauthorizedAccessException e)
{
throw new NuGetConfigurationException(
string.Format(CultureInfo.CurrentCulture, Resources.ShowError_ConfigUnauthorizedAccess, ConfigFilePath, e.Message), e);
}
catch (XmlException e)
{
throw new NuGetConfigurationException(
string.Format(CultureInfo.CurrentCulture, Resources.ShowError_ConfigInvalidXml, ConfigFilePath, e.Message), e);
}
catch (Exception e)
{
throw new NuGetConfigurationException(
string.Format(CultureInfo.CurrentCulture, Resources.Unknown_Config_Exception, ConfigFilePath, e.Message), e);
}
Verbose Logs
No response