Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetFolderPath_Windows tests ~all fail on Nano #21430

Open
danmoseley opened this issue Apr 28, 2017 · 19 comments · Fixed by dotnet/corefx#19948
Open

GetFolderPath_Windows tests ~all fail on Nano #21430

danmoseley opened this issue Apr 28, 2017 · 19 comments · Fixed by dotnet/corefx#19948
Labels
area-System.Runtime bug disabled-test The test is disabled in source code against the issue os-windows-nano Nano Windows SKU test-run-core Test failures in .NET Core test runs
Milestone

Comments

@danmoseley
Copy link
Member

https://mc.dot.net/#/product/netcore/master/source/official~2Fcorefx~2Fmaster~2F/type/test~2Ffunctional~2Fcli~2F/build/20170428.02/workItem/System.Runtime.Extensions.Tests

eg

Assert.Equal() Failure\r\n                                 ? (pos 40)\r\nExpected: ···config\\systemprofile\r\nActual:   ···config\\systemprofile\\AppData\\Local\\Microsoft\\Windows\\History\r\n                                 ? (pos 40)
Stack Trace :
   at System.Tests.EnvironmentTests.GetFolderPath_Windows(SpecialFolder folder)

need fixing.

@danmoseley
Copy link
Member Author

danmoseley commented Apr 28, 2017

On Nano, what we return (directly from SHGetKnownFolderPath) is apparenlty not matching what test gets from SHGetFolderPathW

@danmoseley
Copy link
Member Author

danmoseley commented May 2, 2017

Same as https://github.com/dotnet/corefx/issues/19221 ,SHGetKnownFolderPath doesn't work on Nano.

@danmoseley
Copy link
Member Author

danmoseley commented May 2, 2017

Here's what I get for each folder. Environment.GetFolderPath (from ShGetKnownFolderPath) is mostly blank, sometimes reasonable. ShGetFolderPath (what the test checks) is either blank or just the user profile folder. Desktop for both of these is the 3rd column

|                           |                                                         |                      |                                                                                            | 
|---------------------------|---------------------------------------------------------|----------------------|--------------------------------------------------------------------------------------------| 
| Environment.SpecialFolder | NANO Environment.GetFolderPath                          | NANO SHGetFolderPath | DESKTOP                                                                                    | 
|---------------------------|---------------------------------------------------------|----------------------|--------------------------------------------------------------------------------------------| 
| Desktop                   |                                                         |                      | C:\Users\myuser\Desktop                                                                    | 
| Programs                  |                                                         |                      | C:\Users\myuser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs                      | 
| MyDocuments               |                                                         |                      | C:\Users\myuser\Documents                                                                  | 
| MyDocuments               |                                                         |                      | C:\Users\myuser\Documents                                                                  | 
| Favorites                 |                                                         |                      | C:\Users\myuser\Favorites                                                                  | 
| Startup                   |                                                         |                      | C:\Users\myuser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup              | 
| Recent                    |                                                         | C:\Users\myuser      | C:\Users\myuser\AppData\Roaming\Microsoft\Windows\Recent                                   | 
| SendTo                    |                                                         | C:\Users\myuser      | C:\Users\myuser\AppData\Roaming\Microsoft\Windows\SendTo                                   | 
| StartMenu                 |                                                         | C:\Users\myuser      | C:\Users\myuser\AppData\Roaming\Microsoft\Windows\Start Menu                               | 
| MyMusic                   |                                                         | C:\Users\myuser      | C:\Users\myuser\Music                                                                      | 
| MyVideos                  |                                                         | C:\Users\myuser      | C:\Users\myuser\Videos                                                                     | 
| DesktopDirectory          |                                                         |                      | C:\Users\myuser\Desktop                                                                    | 
| MyComputer                |                                                         |                      |                                                                                            | 
| NetworkShortcuts          |                                                         |                      | C:\Users\myuser\AppData\Roaming\Microsoft\Windows\Network Shortcuts                        | 
| Fonts                     |                                                         |                      | C:\WINDOWS\Fonts                                                                           | 
| Templates                 |                                                         |                      | C:\Users\myuser\AppData\Roaming\Microsoft\Windows\Templates                                | 
| CommonStartMenu           |                                                         |                      | C:\ProgramData\Microsoft\Windows\Start Menu                                                | 
| CommonPrograms            |                                                         |                      | C:\ProgramData\Microsoft\Windows\Start Menu\Programs                                       | 
| CommonStartup             |                                                         | C:\Users\myuser      | C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup                               | 
| CommonDesktopDirectory    |                                                         | C:\Users\myuser      | C:\Users\Public\Desktop                                                                    | 
| ApplicationData           |                                                         | C:\Users\myuser      | C:\Users\myuser\AppData\Roaming                                                            | 
| PrinterShortcuts          |                                                         | C:\Users\myuser      |                                                                                            | 
| LocalApplicationData      | C:\Users\myuser\AppData\Local                           | C:\Users\myuser      | C:\Users\myuser\AppData\Local                                                              | 
| InternetCache             | C:\Users\myuser\AppData\Local\Temporary Internet Files  | C:\Users\myuser      | C:\Users\myuser\AppData\Local\Microsoft\Windows\INetCache                                  | 
| Cookies                   | C:\Users\myuser\Cookies                                 | C:\Users\myuser      | C:\Users\myuser\AppData\Local\Microsoft\Windows\INetCookies                                | 
| History                   | C:\Users\myuser\AppData\Local\Microsoft\Windows\History | C:\Users\myuser      | C:\Users\myuser\AppData\Local\Microsoft\Windows\History                                    | 
| CommonApplicationData     | C:\ProgramData                                          | C:\Users\myuser      | C:\ProgramData                                                                             | 
| Windows                   |                                                         | C:\Users\myuser      | C:\WINDOWS                                                                                 | 
| System                    |                                                         | C:\Users\myuser      | C:\WINDOWS\system32                                                                        | 
| ProgramFiles              | C:\Program Files                                        | C:\Users\myuser      | C:\Program Files                                                                           | 
| MyPictures                |                                                         | C:\Users\myuser      | D:\Users\myuser\Pictures                                                                   | 
| UserProfile               | C:\Users\myuser                                         | C:\Users\myuser      | C:\Users\myuser                                                                            | 
| SystemX86                 |                                                         | C:\Users\myuser      | C:\WINDOWS\SysWOW64                                                                        | 
| ProgramFilesX86           |                                                         | C:\Users\myuser      | C:\Program Files (x86)                                                                     | 
| CommonProgramFiles        |                                                         | C:\Users\myuser      | C:\Program Files\Common Files                                                              | 
| CommonProgramFilesX86     |                                                         | C:\Users\myuser      | C:\Program Files (x86)\Common Files                                                        | 
| CommonTemplates           |                                                         | C:\Users\myuser      | C:\ProgramData\Microsoft\Windows\Templates                                                 | 
| CommonDocuments           |                                                         | C:\Users\myuser      | C:\Users\Public\Documents                                                                  | 
| CommonAdminTools          |                                                         | C:\Users\myuser      | C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools                  | 
| AdminTools                |                                                         | C:\Users\myuser      | C:\Users\myuser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools | 
| CommonMusic               |                                                         | C:\Users\myuser      | C:\Users\Public\Music                                                                      | 
| CommonPictures            |                                                         | C:\Users\myuser      | C:\Users\Public\Pictures                                                                   | 
| CommonVideos              |                                                         | C:\Users\myuser      | C:\Users\Public\Videos                                                                     | 
| Resources                 |                                                         | C:\Users\myuser      | C:\WINDOWS\resources                                                                       | 
| LocalizedResources        |                                                         | C:\Users\myuser      |                                                                                            | 
| CommonOemLinks            |                                                         | C:\Users\myuser      |                                                                                            | 
| CDBurning                 |                                                         | C:\Users\myuser      | C:\Users\myuser\AppData\Local\Microsoft\Windows\Burn\Burn                                  | 

@danmoseley
Copy link
Member Author

@JeremyKuhne fyi.

@danmoseley
Copy link
Member Author

@karelz
Copy link
Member

karelz commented May 19, 2017

Do we want to fix it in 2.0?

@KristinXie1
Copy link

This issue failed again, detail: https://mc.dot.net/#/product/netcore/master/source/official~2Fcorefx~2Fmaster~2F/type/test~2Ffunctional~2Fportable~2Fcli~2F/build/20170519.01/workItem/System.Runtime.Extensions.Tests/analysis/xunit/System.Tests.EnvironmentTests~2FGetFolderPath_Windows(folder:%20CommonStartMenu)

Message:
Assert.NotEqual() Failure
Expected: Not ""
Actual: ""

Stack Trace:
at System.Tests.EnvironmentTests.GetFolderPath_Windows(SpecialFolder folder)

@KristinXie1 KristinXie1 reopened this May 19, 2017
@danmoseley
Copy link
Member Author

Likely have to use Environment variables - they cover all the major ones: documents, appdata, etc.

@TravisEz13
Copy link

TravisEz13 commented Apr 2, 2018

@ViktorHofer This is broken again in the 1709 nanoserver image

Repro:

docker run -it microsoft/powershell:nanoserver
 [System.Environment+SpecialFolder]::GetNames([System.Environment+SpecialFolder]) | %{ "$_ - "+[System.Environment]::GetFolderPath($_)} 

Actual result:

Desktop -
Programs -
MyDocuments -
Personal -
Favorites -
Startup -
Recent -
SendTo -
StartMenu -
MyMusic -
MyVideos -
DesktopDirectory -
MyComputer -
NetworkShortcuts -
Fonts -
Templates -
CommonStartMenu -
CommonPrograms -
CommonStartup -
CommonDesktopDirectory -
ApplicationData -
PrinterShortcuts -
LocalApplicationData -
InternetCache -
Cookies -
History -
CommonApplicationData -
Windows -
System -
ProgramFiles -
MyPictures -
UserProfile -
SystemX86 -
ProgramFilesX86 -
CommonProgramFiles -
CommonProgramFilesX86 -
CommonTemplates -
CommonDocuments -
CommonAdminTools -
AdminTools -
CommonMusic -
CommonPictures -
CommonVideos -
Resources -
LocalizedResources -
CommonOemLinks -
CDBurning -

Expected result (Windows VM on a Mac):

Desktop - \\Mac\Home\Desktop
Programs - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
MyDocuments - \\Mac\Home\Documents
Personal - \\Mac\Home\Documents
Favorites - C:\Users\travisplunk\Favorites
Startup - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Recent - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\Recent
SendTo - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\SendTo
StartMenu - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\Start Menu
MyMusic - \\Mac\Home\Music
MyVideos - \\Mac\Home\Movies
DesktopDirectory - \\Mac\Home\Desktop
MyComputer -
NetworkShortcuts - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\Network Shortcuts
Fonts - C:\WINDOWS\Fonts
Templates - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\Templates
CommonStartMenu - C:\ProgramData\Microsoft\Windows\Start Menu
CommonPrograms - C:\ProgramData\Microsoft\Windows\Start Menu\Programs
CommonStartup - C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
CommonDesktopDirectory - C:\Users\Public\Desktop
ApplicationData - C:\Users\travisplunk\AppData\Roaming
PrinterShortcuts - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
LocalApplicationData - C:\Users\travisplunk\AppData\Local
InternetCache - C:\Users\travisplunk\AppData\Local\Microsoft\Windows\INetCache
Cookies - C:\Users\travisplunk\AppData\Local\Microsoft\Windows\INetCookies
History - C:\Users\travisplunk\AppData\Local\Microsoft\Windows\History
CommonApplicationData - C:\ProgramData
Windows - C:\WINDOWS
System - C:\WINDOWS\system32
ProgramFiles - C:\Program Files
MyPictures - \\Mac\Home\Pictures
UserProfile - C:\Users\travisplunk
SystemX86 - C:\WINDOWS\SysWOW64
ProgramFilesX86 - C:\Program Files (x86)
CommonProgramFiles - C:\Program Files\Common Files
CommonProgramFilesX86 - C:\Program Files (x86)\Common Files
CommonTemplates - C:\ProgramData\Microsoft\Windows\Templates
CommonDocuments - C:\Users\Public\Documents
CommonAdminTools - C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
AdminTools - C:\Users\travisplunk\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
CommonMusic - C:\Users\Public\Music
CommonPictures - C:\Users\Public\Pictures
CommonVideos - C:\Users\Public\Videos
Resources - C:\WINDOWS\resources
LocalizedResources -
CommonOemLinks -
CDBurning - C:\Users\travisplunk\AppData\Local\Microsoft\Windows\Burn\Burn

@ViktorHofer
Copy link
Member

cc @danmosemsft

@danmoseley
Copy link
Member Author

@TravisEz13 are you saying this worked before? As based on my experiments at the top of the page, it never produced anything useful.

I am not sure why I noted "seems to be fixed" as I see the test is still disabled for Nano. We should probably keep this open to try to find another method (env vars) since clearly folks need it.

I will check with Nano folks about the API.

@TravisEz13
Copy link

@danmosemsft I'm not saying it worked before. I was basing the "again" part on the "seems to be fixed" statement.

@danmoseley
Copy link
Member Author

@TravisEz13 ah right. I have an email out...

@krwq
Copy link
Member

krwq commented Apr 4, 2018

Please reenable when fixing it (disabled on nano server) or leave so comment why it is ok to be disabled when fixing/closing this:

System.Runtime.Extensions/tests/System/EnvironmentTests.cs:229:                // https://github.com/dotnet/corefx/issues/19110
System.Runtime.Extensions/tests/System/EnvironmentTests.cs:342:        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] // https://github.com/dotnet/corefx/issues/19110

Reopening it while investigation is pending

@krwq krwq reopened this Apr 4, 2018
@OnurGumus
Copy link

Any updates on this?

@danmoseley
Copy link
Member Author

danmoseley commented Aug 8, 2019

@OnurGumus nobody has looked at it. We would welcome a PR 😃

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@joperezr joperezr removed the untriaged New issue has not been triaged by the area owner label Jul 1, 2020
@eerhardt
Copy link
Member

We are running into this in #68580 (comment) as well. Will disable this test when Environment.GetFolderPath(Environment.SpecialFolder.System); returns null or empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Runtime bug disabled-test The test is disabled in source code against the issue os-windows-nano Nano Windows SKU test-run-core Test failures in .NET Core test runs
Projects
None yet
Development

Successfully merging a pull request may close this issue.