System.InvalidOperationException while defining parenthesis in column property in DataTable collection
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/SystemInvalidOperationException-while-d/1397282)._
---
I have defined the column name with parenthesis in the DataTable collection. In this case, while loading DataGrid System.InvalidOperationException. Replication procedure to reproduce the reported issue,
Step 1: set the column name property as below mentioned
```
//I have defined the column name with parenthesis
table. Columns.Add("Location in die [X,Y] in um", typeof(string));
```
Please refer the screenshot,
! [ColumnNameDefining.png] (https://aka.ms/dc/image?name=Bdb0828c36f234872828b26fd468233f8637539273471904671_ColumnNameDefining.png&tid=db0828c36f234872828b26fd468233f8637539273471904671)
Step 2: Set the ItemSource as DataTable collection. Please refer the below code snippet,
```
```
Step 3: Run the sample
Step 4: System.InvalidOperationException occurs
StackTrace details for your reference,
at System.Windows.PropertyPath.PrepareSourceValueInfo(ITypeDescriptorContext typeDescriptorContext)
at System.Windows.PropertyPath.. ctor(String path, Object[] pathParameters)
at System.Windows.Data.Binding.. ctor(String path)
at System.Windows.Controls.DataGridColumn.CreateDefaultColumn(ItemPropertyInfo itemProperty)
at System.Windows.Controls.DataGrid.GenerateColumns(ReadOnlyCollection`1 itemProperties, DataGrid dataGrid, Collection`1 columnCollection)
at System.Windows.Controls.DataGrid.AddAutoColumns()
at System.Windows.Controls.DataGrid.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at MS. Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Controls.Border.MeasureOverride(Size constraint)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Window.MeasureOverrideHelper(Size constraint)
at System.Windows.Window.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at System.Windows.Window.SetRootVisual()
at System.Windows.Window.SetRootVisualAndUpdateSTC()
at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.CreateSourceWindowDuringShow()
at System.Windows.Window.SafeCreateWindowDuringShow()
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS. Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS. Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS. Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS. Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS. Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS. Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at SyntaxErrorException.App.Main()
I have attached the sample for your reference
Sample Link: [SyntaxErrorException.zip](https://aka.ms/dc/file?name=Bdcf29b1aa5ee44eabba231904b3ab55f637539276935402533_SyntaxErrorException.zip&tid=dcf29b1aa5ee44eabba231904b3ab55f637539276935402533)
Can anyone share an idea to resolve the reported problem?
Regards,
Vijayarasan S
---
### Original Comments
#### Feedback Bot on 4/14/2021, 03:23 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
#### Vijayarasan Sivanandham on 6/16/2021, 00:33 PM:
Hi Team,
Any update on this.
Regards,
Vijayarasan S
#### Feedback Bot on 8/2/2021, 03:27 PM:
I detected that this issue hasn’t received a lot of activity, votes, or comments in the past 90 days. Based on this, the issues severity and affected area, it’s my experience that this issue is unlikely to get fixed. To improve the situation, consider following best practices for quality problem reports, and giving us more details on how this issue is impacting you.
#### Mila Zhou[MSFT] on 1/21/2022, 05:51 PM:
Thank you for taking the time to log this issue! Did you still reproduce this issue in the latest stable version of Visual Studio installed from https://visualstudio.microsoft.com/downloads ?
#### Vijayarasan Sivanandham on 2/9/2022, 04:21 PM:
Hi Team,
I have tested with the latest Visual Studio 2022. The reported problem still occurs. Please find the Visual Studio version details in the below mentioned screen shot,

Regards,
Vijayarasan S
#### Feedback Bot on 2/9/2022, 03:23 PM:
We will close this report in 14 days because we don’t have enough information to investigate further. To keep the problem open, please provide the requested details.
#### Feedback Bot on 2/11/2022, 01:41 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
---
### Original Solutions
(no solutions)
Contributor guide
Assessment
This issue has not been assessed yet.