XamlStyler icon indicating copy to clipboard operation
XamlStyler copied to clipboard

Settings file is not loaded if solution is opened

Open jcsonder opened this issue 6 years ago • 5 comments

If you define an External Configuration File without path and put the file next to the .sln file (as described here) the file gets not loaded in every situation. It does not work if you open a recently used solution via right click on a VisualStudio icon/shortcut. It does work if you double click on the .sln file directly.

jcsonder avatar May 30 '18 12:05 jcsonder

Are there any informations regarding the investigation whether this is a bug of VS or XamlStyler? Respectively can someone predict when it will be fixed?

XamlNerd avatar Oct 24 '18 08:10 XamlNerd

I was previously not able to repro the problem, but I try again with latest version of VS + XAML Styler. If anyone is seeing this problem, please post versions for VS + XAML Styler to help investigate.

Update: I am not able to repro on 15.8.7 with latest out of master.

grochocki avatar Oct 26 '18 08:10 grochocki

The issue is still reproduceable as described in my opening post. Setting: External configuration file: Settings.XamlStyle I put the file next to the .sln file. The content of the file is default (https://github.com/Xavalon/XamlStyler/wiki/External-Configurations) except that I changed the value of AttributesTolerance to 4 as my test case to see if this file is used or not. Visual Studio 15.9.2 XAML Styler 3.1

jcsonder avatar Nov 20 '18 14:11 jcsonder

I was able to reproduce the issue when debugging XamlStyler.Console. I guess the same happens when running the VS extension. Images: https://imgur.com/a/uG8TgNY The image XamlStyler_Issue153_Image2 shows the used options: Check the watch window! The image XamlStyler_Issue153_Image1 shows how the given configuration file is loaded: Check watch window again! With this settings there is no directory set when the file gets loaded. The variable config contains only a filename: "Settings.XamlStyler". And so File.Exists() consider this a relative path and will check the current working directory which is not in both cases, which I described in my first post, the same! https://docs.microsoft.com/en-us/dotnet/api/system.io.file.exists?view=netframework-4.7.2 Could this be the reason?

jcsonder avatar Nov 20 '18 15:11 jcsonder

@jcsonder Can you share the configuration file you were using here to help debug?

grochocki avatar Sep 23 '19 08:09 grochocki