Home Dashboard Directory Help
Search

Assert returns wrong message in exception by Harry-vB


Status: 

Closed
 as Not Reproducible Help for as Not Reproducible


2
0
Sign in
to vote
Type: Bug
ID: 777498
Opened: 1/25/2013 5:33:44 AM
Access Restriction: Public
0
Workaround(s)
view
1
User(s) can reproduce this bug

Description

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")
Details
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.
Regards,
Harry
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(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
MSConnect777498.zip 2/3/2013 10 KB
MSConnect777498.zip 2/3/2013 10 KB