Assert returns wrong message in exception - by Harry-vB

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 777498 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 1/25/2013 5:33:44 AM
Access Restriction Public


An assert that compares a string containing a "{" and uses a message with format arguments returns a wrong message in exception.

This bug is because the method builds the message in a first step to
"Expected:<a>. Actual:<{>. My {0}"
and then calls
String.Format("Expected:<a>. Actual:<{>. My {0}", "Message")
which yields the wrong exception. You should better use a code like this:
"Expected:<a>. Actual:<{>. " + String.Format( "My {0}", "Message")
Sign in to post a comment.
Posted by Harry-vB on 2/5/2013 at 11:08 PM
Hello again,
what's going on here? Why did you closed this bug as "not reproducable"? Even if there is another exception, it is still not the exception expected. It is essentially for the Assert methods to return the correct exceptions.
Posted by Harry-vB on 2/3/2013 at 11:50 PM
Hi Microsoft,
I've just uploaded a test project that should show the problem.
- Start the project with VS2012
- Select TEST -> Run -> All Tests
You should see the Test window telling you that the test failed giving the exception I've originally reported.
Posted by Microsoft on 2/1/2013 at 1:59 AM
Hi Harry-vB, we'll close this feeback within this week. Please reply to us in time if you have not resolved this issue. Thanks
Posted by Microsoft on 1/31/2013 at 1:58 AM
Hi Harry-vB, we want to remind you we get another exception. We can't repro your issue, please help us. Thanks.
Posted by Microsoft on 1/28/2013 at 2:29 AM
Hi Harry-vB, thank you submitting feedback on Visual Studio and .Net Framework. In my case, VS sent an exception like:
Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingsHelper.MergeRunSettingsAndFindCompatibleSources(Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture ByRef, Microsoft.VisualStudio.TestPlatform.ObjectModel.FrameworkVersion ByRef, System.String, System.String, System.Collections.Generic.IDictionary`2<System.String,System.Collections.Generic.KeyValuePair`2<Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture,Microsoft.VisualStudio.TestPlatform.ObjectModel.FrameworkVersion>>, System.Xml.XPath.IXPathNavigable, System.String ByRef)'.'
Please contact the plugin author.
Exception has been thrown by the target of an invocation.
Please confirm. Thanks
Posted by Microsoft on 1/25/2013 at 5:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(