TemplateStudio icon indicating copy to clipboard operation
TemplateStudio copied to clipboard

Project Creation Stuck on Creating Project

Open iltan987 opened this issue 3 years ago • 17 comments
trafficstars

Describe the bug

I have installed Template Studio for UWP using Visual Studio Extensions Market. Screenshot 2022-10-10 182652 I didn't change any settings. I am just creating new default Template Studio for UWP Project. I have waited a lot but nothing happens. Everything is latest version. If necessary I can give more details but it's simple. Please help me if I am doing something wrong. Thanks.

To Reproduce

Start Visual Studio Press Create New Project and select Template Studio for UWP. On the Details section, do not change any settings and directly press Create. It stuck on Creating Project screen with a progress bar.

Additional context

No response

Applies to the following platforms:

  • [ ] WinUI
  • [ ] WPF
  • [x] UWP

About your setup

  • Visual Studio Version: Latest (17.3.5)
  • Template Studio Wizard Version: 5.2 Screenshot 2022-10-10 183316
  • Windows Build: 21H2 Build: 19044.2075

iltan987 avatar Oct 10 '22 15:10 iltan987

I could not repro on Windows 11 22H2. It took a minute to create the project but it eventually did complete.

mikebattista avatar Oct 11 '22 05:10 mikebattista

Same issue when creating WinUI.

Win11 22H2 VS2022 17.5.3 Template Studio for WinUI (C#) 5.3

GF-Huang avatar Mar 24 '23 01:03 GF-Huang

Same or related isuue on WinUI, WPF, and UWP. Versions are same with last comment, but I can see error message in my case.

System.UnauthorizedAccessException: Access to the path 'C:\Users\myname\AppData\Local\Application Data' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
   at System.IO.FileSystemEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.Templates.Core.PostActions.PostActionFactory.AddMergeActions(GenInfo genInfo, List`1 postActions, String searchPattern, Boolean failOnError)
   at Microsoft.Templates.Core.PostActions.NewProjectPostActionFactory.FindPostActions(GenInfo genInfo, ITemplateCreationResult genResult)
   at Microsoft.Templates.Core.Gen.GenController.ExecutePostActions(GenInfo genInfo, ITemplateCreationResult generationResult)
   at Microsoft.Templates.Core.Gen.GenController.<GenerateItemsAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Templates.Core.Gen.NewProjectGenController.<UnsafeGenerateProjectAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Templates.UI.Services.GenerationService.<GenerateProjectAsync>d__5.MoveNext()

honehone12 avatar Mar 25 '23 12:03 honehone12

@honehone12 That indicates a permission issue.

To help identify the exact issue:

Do you have any restrictions on the account your using on that machine? Do you have Visual Studio installed on a drive other than 'C'? Do you get the same result if you run Visual Studio as an Administrator?

mrlacey avatar Mar 25 '23 22:03 mrlacey

@mrlacey I have an update. After making "solution and project in same directory" unchecked, template studio works. It might be my case was related to https://github.com/microsoft/TemplateStudio/issues/4416#issue-1183910370. Thank you anyway!

honehone12 avatar Mar 26 '23 02:03 honehone12

@mrlacey I have an update. After making "solution and project in same directory" unchecked, template studio works. It might be my case was related to #4416 (comment). Thank you anyway!

It is unchecked in default, not work for me.

GF-Huang avatar Mar 26 '23 06:03 GF-Huang

@honehone12 and @GF-Huang What directory are you trying to create the project in? (If it's a subdirectory of AppData that might also be a factor)

For note, even if this is tied to the same underlying issue as #4416, I'd still like to fix this so it doesn't hang indefinitely. (Which I suspect is due to an exception being swallowed and something never completing.)

mrlacey avatar Mar 26 '23 14:03 mrlacey

What directory are you trying to create the project in?

Desktop.

GF-Huang avatar Mar 26 '23 14:03 GF-Huang

@mrlacey C:/Users/myname

honehone12 avatar Mar 26 '23 15:03 honehone12

Thank you both. I can repro what you're seeing. (Although not the infinite hang) Yes, this is the same issue as #4416 The wizard is trying to access directories it shouldn't and (rightly) doesn't have permission to access.

Note. This doesn't reflect the issue in the original screenshot, as that is using a path that shouldn't be affected.

mrlacey avatar Mar 26 '23 15:03 mrlacey

Thank you both. I can repro what you're seeing. (Although not the infinite hang) Yes, this is the same issue as #4416 The wizard is trying to access directories it shouldn't and (rightly) doesn't have permission to access.

Note. This doesn't reflect the issue in the original screenshot, as that is using a path that shouldn't be affected.

Any workarounds?

GF-Huang avatar Mar 27 '23 06:03 GF-Huang

Any workarounds?

The workaround for putting the solution and project in the same directory is to not do this during generation. You can then move them after creation.

For hangs of another reason, I don't have a solution or workaround as we're unable to recreate.

I'm working on solution for the same directory issue but a lot of the original logic was based on the assumption that there will always be a solution directory,

mrlacey avatar Mar 27 '23 08:03 mrlacey

@mrlacey Where can I find the log files? I want to post you for solves this issue.

GF-Huang avatar Mar 27 '23 08:03 GF-Huang

@mrlacey Where can I find the log files? I want to post you for solves this issue.

Logs will be in something equivalent to C:\Users\matt\AppData\Local\TS4WinUICs\Logs

and look like this: image

Another thing you can try is to:

  • Start Visual Studio without any code (so it loads the basic shell/UI
  • Then select File > New > Project
  • Select options in the wizard and click Create.
  • See if any messages are reported in the StatusBar e.g.

image

mrlacey avatar Mar 27 '23 08:03 mrlacey

Ha, I create project successful today. Is it depends network during creation?

GF-Huang avatar Mar 27 '23 09:03 GF-Huang

Ha, I create project successful today. Is it depends network during creation?

The only network-related thing it does is restore NuGet packages. If you've never built with that version of WinAppSDK before it could bring down a lot and that may take a lot of time....

mrlacey avatar Mar 27 '23 09:03 mrlacey

I compare today and previous log files, previous day it stucks at

Information	Generating the template ts.WinUI.Project.Core.AddPlatforms to C:\Users\MyName\Desktop\App1.

I think it maybe the issue as you thought. If it is, maybe do the restoring NuGet package step after VS main window display will be better if template studio can control this; otherwise peoples who creating project from Start Window can not see the bottom status bar.

GF-Huang avatar Mar 27 '23 09:03 GF-Huang