Create a Switch activity with TypeArgument = String
Click “Add Case” button
Error:
System.Exception: Object reference not set to an instance of an object
at UiPath.PackageActivitiesMetadata.ViewModels.SwitchViewModel`1.CreateDefaultItemForProperty(String propertyName)
Workaround: manually add cases via XAML using x:Key=“CaseName”
This looks like a Studio designer issue in the 26.0 cloud version, not a problem with your workflow.
Why this happens
When you change the Switch activity TypeArgument to String and click Add Case, Studio tries to auto-create a new case entry in the UI. In this version, that process is failing internally (null reference in SwitchViewModel), so it throws the error instead of adding the case.
So basically:
Switch<String> is valid and supported
But the designer UI is breaking while adding cases
Runtime/XAML itself still works fine
How to resolve (workaround)
Until UiPath fixes this in a patch, you can do the following:
Open the .xaml file in a text editor (Notepad++ or similar).