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

App.config is not created when Settings are modified #7772

Closed
Tracked by #8058
RussKie opened this issue Nov 15, 2021 · 1 comment · Fixed by #8110
Closed
Tracked by #8058

App.config is not created when Settings are modified #7772

RussKie opened this issue Nov 15, 2021 · 1 comment · Fixed by #8110
Assignees
Labels
Feature-Settings-Designer Specific to the settings file designer. Feature-WinForms Features related to bringing up the Windows Forms designer and related features. Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. Triage-Investigate Reviewed and investigation needed by dev team
Milestone

Comments

@RussKie
Copy link
Member

RussKie commented Nov 15, 2021

Porting from AB#1386445 for public awareness.

Summary

I debugged and narrowed the problem down to the following code:

Try
VSErrorHandler.ThrowOnFailure(ProjSpecialFiles.GetFile(__PSFFILEID.PSFFILEID_AppConfig, Flags, AppConfigItemId, AppConfigFileName))
Catch ex As System.Runtime.InteropServices.COMException When ex.ErrorCode = Interop.Win32Constant.OLE_E_PROMPTSAVECANCELLED
Throw New ComponentModel.Design.CheckoutException(My.Resources.Microsoft_VisualStudio_Editors_Designer.DFX_UnableToCheckout, ex)
Catch ex As Exception When TypeOf ex IsNot ComponentModel.Design.CheckoutException
' VsWhidbey 224145, ProjSpecialFiles.GetFile(create:=true) fails on vbexpress sku
AppConfigItemId = VSITEMID.NIL
Debug.Fail(String.Format("ProjSpecialFiles.GetFile (create={0}) failed: {1}", CreateIfNotExists, ex))
End Try

When attempting to get the file with __PSFFLAGS.PSFF_CreateIfNotExist Or __PSFFLAGS.PSFF_FullPath fails with the following error:

image

   at EnvDTE80.Solution2.GetProjectItemTemplate(String TemplateName, String Language)
   at Microsoft.VisualStudio.ProjectSystem.VS.CreateFileFromTemplateService.<CreateFileAsync>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 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.VisualStudio.ProjectSystem.SpecialFileProviders.AbstractSpecialFileProvider.<CreateDefaultFileAsync>d__6.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 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.VisualStudio.ProjectSystem.SpecialFileProviders.AbstractSpecialFileProvider.<GetFileAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<GetSpecialFilePathAsync>d__557.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.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass508_0.<<GetFile>b__0>d.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.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously(Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.HResult.<>c__DisplayClass37_0.<Invoke>b__0()
   at Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(Func`1 action, IServiceProvider vsShellServiceProvider, IProjectFaultHandlerService projectFaultHandlerService, UnconfiguredProject project)

Narrowed down more, this is what's causing the error - the zip file isn't getting found
image

I can speculate that https://devdiv.visualstudio.com/DevDiv/_git/VS?path=/src/vsproject/Templates/Windows/CSharp/ItemTemplates/AppConfigInternal is either not getting built, or the archive isn't getting packaged...

Expected Behavior

The app.config is being created whenever settings are changed.

User Impact

Wide, e.g., https://stackoverflow.com/q/65518159

@tmeschter tmeschter added Bug Feature-Settings-Designer Specific to the settings file designer. Feature-WinForms Features related to bringing up the Windows Forms designer and related features. labels Dec 3, 2021
@tmeschter tmeschter added this to the 17.2 milestone Dec 3, 2021
@tmeschter
Copy link
Contributor

@melytc @drewnoakes One to consider as you look at VB work for 17.2.

@tmeschter tmeschter added the Triage-Investigate Reviewed and investigation needed by dev team label Dec 3, 2021
@melytc melytc modified the milestones: 17.2, 17.3 Mar 14, 2022
@ghost ghost added the Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. label Apr 27, 2022
@drewnoakes drewnoakes removed the Bug label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Settings-Designer Specific to the settings file designer. Feature-WinForms Features related to bringing up the Windows Forms designer and related features. Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. Triage-Investigate Reviewed and investigation needed by dev team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants