FileVersionInfo.GetVersionInfo("D:/Notepad.exe").FileVersion act in different way when the file is Open or not.
If the file is Open the version returned is empty
Don't know if a bug of Sharpdevelop or .NET framework. In any case all other file properties are returned correctly (length, creation date, modification date, etc.).
In order to reproduce the issue, try this:
voidButton2Click(object sender, EventArgs e)
{
string versionFile = FileVersionInfo.GetVersionInfo("D:/Notepad.exe").FileVersion;
using (var fs1 = newBinaryReader (File.Open ("D:/Notepad.exe", FileMode.Open)))
{
MessageBox.Show ("Version: " + versionFile); // returns correct fileversion
MessageBox.Show ("Version: " + FileVersionInfo.GetVersionInfo("D:/Notepad.exe").FileVersion); // returns null
}
Pc Configuration:
Windows 7
SharpDevelop Version : 5.1.0.5216-0e58df71
.NET Version : 4.6.01055