If I have defined a name that refers to a table range or formula, the ranges property produces an "Invalid Operation Exception"
For example
Name -> ProductionNightDay
RefersTo -> ProductionTable[[Nightshift]:[Dayshift]]
Ranges -> See Exception below
Is there a way to catch this without an exception?
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=Sequence contains no matching element
Source=System.Core
StackTrace:
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at ClosedXML.Excel.XLNamedRange.<get_Ranges>b__6(<>f__AnonymousType4`2 <>h__TransparentIdentifier2)
at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at ClosedXML.Excel.XLNamedRange.get_Ranges()
at ClosedXML.Excel.XLWorksheet.Range(String rangeAddressStr)
at ClosedXML.Excel.XLWorksheet.ClosedXML.Excel.IXLWorksheet.Range(String rangeAddress)
at TestBid.Program.Main(String[] args) in C:\Users\user\Documents\Visual Studio 2010\Projects\Test\Test\Program.cs:line 34
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
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 System.Threading.ThreadHelper.ThreadStart()
InnerException:
Comments: Attach the file.
For example
Name -> ProductionNightDay
RefersTo -> ProductionTable[[Nightshift]:[Dayshift]]
Ranges -> See Exception below
Is there a way to catch this without an exception?
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=Sequence contains no matching element
Source=System.Core
StackTrace:
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at ClosedXML.Excel.XLNamedRange.<get_Ranges>b__6(<>f__AnonymousType4`2 <>h__TransparentIdentifier2)
at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at ClosedXML.Excel.XLNamedRange.get_Ranges()
at ClosedXML.Excel.XLWorksheet.Range(String rangeAddressStr)
at ClosedXML.Excel.XLWorksheet.ClosedXML.Excel.IXLWorksheet.Range(String rangeAddress)
at TestBid.Program.Main(String[] args) in C:\Users\user\Documents\Visual Studio 2010\Projects\Test\Test\Program.cs:line 34
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
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 System.Threading.ThreadHelper.ThreadStart()
InnerException:
Comments: Attach the file.