Share via


An error "#endregion directive expected" in UIMap.cs when trying to build my CodedUI tests

Question

Friday, August 1, 2014 8:45 AM

#endregion directive expected. There were no errors before, I've opened my regression pack after 2 weeks to add in new functionality tests. Can someone please help me on this?

Thanks

All replies (2)

Friday, August 1, 2014 9:14 AM âś…Answered

Hi Raj,

the error points out what is missing, an #endregion. :-) Regions are defined by you and are used by the code-editor. The code-editor allows you to collapse regions. Each region has an opening and a closing element

#region

// Your code here
#endregion

You can also nest regions:

#region

// Your code here
#region

// Code in nested region
#endregion

#endregion

And you can also put some text behind a #region and #endregion

#region MainCode

// Your code here
#region Nested code

// Code in nested region
#endregion Nested code

#endregion MainCode

In your case your code seems to be somewhat like this:

#region MainCode

// Your code here
#region Nested code

// Code in nested region
#endregion Nested code

You're missing some endregion. So check your code if each region is closed correctly with an endregion.

Thomas Claudius Huber

"If you can't make your app run faster, make it at least look & feel extremly fast"

My latest Pluralsight-course: Windows Store Apps - Data Binding in Depth

twitter: @thomasclaudiush
homepage: www.thomasclaudiushuber.com
author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook


Friday, August 1, 2014 10:17 AM

Thanks Thomas,

Though this code is generated by CodedUI recording, there were so many #endregions missing, it was unexpected. I've added many but I've missed couple of them.