<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:36 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-702] Stack trace when casting </title>
                <link>https://jira.mongodb.org/browse/CSHARP-702</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Using the following method:&lt;/p&gt;

&lt;p&gt;        public static T ToId&amp;lt;T&amp;gt;(string meetingId)&lt;br/&gt;
        {&lt;br/&gt;
            if (typeof(T) == typeof(Guid))&lt;/p&gt;
            {
                Guid guidId;
                Guid.TryParse(meetingId, out guidId);
                return (T)Convert.ChangeType(guidId, typeof(T));
            }
&lt;p&gt;            else if (typeof(T) == typeof(ObjectId))&lt;/p&gt;
            {
                ObjectId objectId;
                ObjectId.TryParse(meetingId, out objectId);
                return (T)Convert.ChangeType(objectId, typeof(T));
            }
&lt;p&gt;            return default(T);&lt;br/&gt;
        }        &lt;/p&gt;

&lt;p&gt;When upgrading from the MongoDb .NET driver 1.5 to version 1.7.1.4791, we&apos;re receiving the following stack trace:&lt;/p&gt;


&lt;p&gt;Message: Specified cast is not valid.&lt;/p&gt;

&lt;p&gt;Stack Trace:&lt;br/&gt;
   at MongoDB.Bson.ObjectId.System.IConvertible.ToType(Type conversionType, IFormatProvider provider)&lt;br/&gt;
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)&lt;br/&gt;
   at System.Convert.ChangeType(Object value, Type conversionType)&lt;br/&gt;
   at Tntp.Controls.ViewModels.Meeting.MeetingBaseViewModel.ToId&lt;span class=&quot;error&quot;&gt;&amp;#91;T&amp;#93;&lt;/span&gt;(String meetingId) in C:\Dev\Tntp.TeacherTrack2\Tntp.Controls\ViewModels\Meeting\MeetingBaseViewModel.cs:line 72&lt;br/&gt;
   at Tntp.Controls.ViewModels.Meeting.MeetingViewModel.GetMeetings(MeetingTypes meetingTypes, String meetingParentId) in C:\Dev\Tntp.TeacherTrack2\Tntp.Controls\ViewModels\Meeting\MeetingSessionViewModel.cs:line 28&lt;br/&gt;
   at Tntp.Web.Admin.UserControls.Meetings.MeetingDetails.Page_Load(Object sender, EventArgs e) in C:\Dev\Tntp.TeacherTrack2\Tntp.Web\Admin\UserControls\Meetings\MeetingDetails.ascx.cs:line 34&lt;br/&gt;
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)&lt;br/&gt;
   at System.Web.UI.Control.OnLoad(EventArgs e)&lt;br/&gt;
   at System.Web.UI.Control.LoadRecursive()&lt;br/&gt;
   at System.Web.UI.Control.LoadRecursive()&lt;br/&gt;
   at System.Web.UI.Control.LoadRecursive()&lt;br/&gt;
   at System.Web.UI.Control.LoadRecursive()&lt;br/&gt;
   at System.Web.UI.Control.LoadRecursive()&lt;br/&gt;
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)&lt;/p&gt;

</description>
                <environment>Windows 7 64bit, .NET 4.0</environment>
        <key id="68288">CSHARP-702</key>
            <summary>Stack trace when casting </summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="craig.wilson@mongodb.com">Craig Wilson</assignee>
                                    <reporter username="icenine">Robert DeSimone</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Wed, 13 Mar 2013 15:54:58 +0000</created>
                <updated>Fri, 5 Apr 2019 13:58:11 +0000</updated>
                            <resolved>Wed, 13 Mar 2013 22:10:13 +0000</resolved>
                                    <version>1.7.1</version>
                                    <fixVersion>1.8</fixVersion>
                                                        <votes>2</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="288591" author="auto" created="Wed, 13 Mar 2013 22:08:35 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-03-13T16:27:14Z&apos;, u&apos;name&apos;: u&apos;Craig Wilson&apos;, u&apos;email&apos;: u&apos;craiggwilson@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-702&quot; title=&quot;Stack trace when casting &quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-702&quot;&gt;&lt;del&gt;CSHARP-702&lt;/del&gt;&lt;/a&gt;: fix ObjectId conversion to itself.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/c2f17f19ef5a39811983c0fbd53d413f11443efb&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/c2f17f19ef5a39811983c0fbd53d413f11443efb&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="288231" author="icenine" created="Wed, 13 Mar 2013 16:29:28 +0000"  >&lt;p&gt;Thanks Craig. That seemed to do the trick! Nice response time!&lt;/p&gt;</comment>
                            <comment id="288230" author="craiggwilson" created="Wed, 13 Mar 2013 16:28:15 +0000"  >&lt;p&gt;Fix in code review.&lt;/p&gt;</comment>
                            <comment id="288216" author="craiggwilson" created="Wed, 13 Mar 2013 16:19:46 +0000"  >&lt;p&gt;I can confirm this.  In the meantime, you can change your code in the ObjectId portion to this:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;else if (typeof(T) == typeof(ObjectId))&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    ObjectId objectId; &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    ObjectId.TryParse(meetingId, out objectId); &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    return (T)(object)objectId;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrmonj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>46076</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>