Skip to content

Commit ac1a25e

Browse files
authored
Fixes unable to cast SettingsDesigner to ResourceEditorRootDesigner exception (#9364)
1 parent 85edaf8 commit ac1a25e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Microsoft.VisualStudio.Editors/DesignerFramework/AccessModifierComboBox.vb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,14 @@ Namespace Microsoft.VisualStudio.Editors.DesignerFramework
441441

442442
For Each codeGenerator As CodeGenerator In _codeGeneratorEntries
443443
If codeGenerator.DisplayName.Equals(value, StringComparison.CurrentCultureIgnoreCase) Then
444-
Dim Designer = CType(RootDesigner, ResourceEditorRootDesigner)
445-
If Designer IsNot Nothing Then
444+
If TypeOf RootDesigner Is ResourceEditorRootDesigner Then
445+
Dim Designer = CType(RootDesigner, ResourceEditorRootDesigner)
446446
Dim ResourceView As ResourceEditorView = Designer.GetView()
447447
' We let the base class handle the read only mode
448448
' As mentioned in ResourceEditorDesignerLoader, "We actually don't want users to edit Form RESX file"
449449
' so we just need to add the same warning as there for now until the new resource explorer is released
450-
If ResourceView IsNot Nothing AndAlso Not ResourceView.ReadOnlyMode
451-
If ResourceView.DsMsgBox(My.Resources.Microsoft_VisualStudio_Editors_Designer.RSE_Err_UpdateADependentFile, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, HelpIDs.Err_EditFormResx) = DialogResult.Yes Then
450+
If ResourceView IsNot Nothing AndAlso Not ResourceView.ReadOnlyMode Then
451+
If ResourceView.DsMsgBox(My.Resources.Microsoft_VisualStudio_Editors_Designer.RSE_Err_UpdateADependentFile, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, HelpIDs.Err_EditFormResx) = DialogResult.Yes Then
452452
_allowEdit = True
453453
End If
454454
End If
@@ -457,6 +457,8 @@ Namespace Microsoft.VisualStudio.Editors.DesignerFramework
457457
End If
458458

459459
_allowEdit = False
460+
Else
461+
TrySetCustomToolValue(codeGenerator.CustomToolValue)
460462
End If
461463
Return
462464
End If

0 commit comments

Comments
 (0)