<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:43:54 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-2937] Use MemoryStream.GetBuffer instead of ToArray when targetting netstandard2.0</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2937</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description></description>
                <environment></environment>
        <key id="1138954">CSHARP-2937</key>
            <summary>Use MemoryStream.GetBuffer instead of ToArray when targetting netstandard2.0</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="mikalai.mazurenka@mongodb.com">Mikalai Mazurenka</assignee>
                                    <reporter username="robert@mongodb.com">Robert Stam</reporter>
                        <labels>
                    </labels>
                <created>Fri, 7 Feb 2020 17:01:36 +0000</created>
                <updated>Thu, 15 Apr 2021 15:35:55 +0000</updated>
                            <resolved>Thu, 15 Apr 2021 15:35:55 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3720523" author="mikalai.mazurenka" created="Thu, 15 Apr 2021 14:53:53 +0000"  >&lt;p&gt;There are 9 total occurrences of MemoryStream class throughout the solution (test projects are excluded):&lt;br/&gt;
 1. &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/f389eb5e04fd55f69c783a321d634983865be048/src/MongoDB.Bson/BsonExtensionMethods.cs#L86&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;BsonExtensionMethods.ToBson&lt;/a&gt;&lt;br/&gt;
 &lt;tt&gt;MemoryStream.GetBuffer()&lt;/tt&gt; usage is not applicable, because &lt;tt&gt;.ToBson()&lt;/tt&gt; is a public method with &lt;tt&gt;byte[]&lt;/tt&gt; return type, while &lt;tt&gt;.GetBuffer()&lt;/tt&gt; usage requires slicing, otherwise technical size (multiplies of 256) is used, which is definitely not what we intent to do (&lt;tt&gt;.ToArray()&lt;/tt&gt; slices the buffer appropriately).&lt;br/&gt;
 2. &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/f389eb5e04fd55f69c783a321d634983865be048/src/MongoDB.Bson/IO/BsonReader.cs#L288&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;BsonReader.ReadRawBsonArray&lt;/a&gt;&lt;br/&gt;
 Already uses &lt;tt&gt;.GetBuffer()&lt;/tt&gt;.&lt;br/&gt;
 3. &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/f389eb5e04fd55f69c783a321d634983865be048/src/MongoDB.Bson/IO/BsonStreamAdapter.cs#L286&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;BsonStreamAdapter.ReadCStringBytes&lt;/a&gt;&lt;br/&gt;
 Already uses &lt;tt&gt;.GetBuffer()&lt;/tt&gt;.&lt;br/&gt;
 4. &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/f389eb5e04fd55f69c783a321d634983865be048/src/MongoDB.Bson/ObjectModel/RawBsonArray.cs#L538&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;RawBsonArray.Materialize&lt;/a&gt;&lt;br/&gt;
 &lt;tt&gt;MemoryStream&lt;/tt&gt; is used as &lt;tt&gt;Stream&lt;/tt&gt;, which does not privide access to &lt;tt&gt;.ToArray()&lt;/tt&gt; and &lt;tt&gt;.GetBuffer()&lt;/tt&gt; methods.&lt;br/&gt;
 5. &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/f389eb5e04fd55f69c783a321d634983865be048/src/MongoDB.Driver.Core/Core/WireProtocol/CommandMessageFieldEncryptor.cs#L62&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;CommandMessageFieldEncryptor.CombineCommandMessageSectionsIntoSingleDocument&lt;/a&gt;&lt;br/&gt;
 &lt;tt&gt;MemoryStream&lt;/tt&gt; is used as &lt;tt&gt;Stream&lt;/tt&gt;, which does not privide access to &lt;tt&gt;.ToArray()&lt;/tt&gt; and &lt;tt&gt;.GetBuffer()&lt;/tt&gt; methods.&lt;br/&gt;
 6. 4 occurrences in &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/f389eb5e04fd55f69c783a321d634983865be048/src/MongoDB.Driver.GridFS/GridFSBucket.cs&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;GridFSBucket&lt;/a&gt; of the same nature&lt;br/&gt;
 In all 4 occurrences &lt;tt&gt;MemoryStream&lt;/tt&gt; is used as &lt;tt&gt;Stream&lt;/tt&gt;, which does not privide access to &lt;tt&gt;.ToArray()&lt;/tt&gt; and &lt;tt&gt;.GetBuffer()&lt;/tt&gt; methods.&lt;/p&gt;

&lt;p&gt;As a summary, no changes are possible to make in scope of this ticket, thus closing it as implemented.&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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CSHARP-2934</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hwd5kf:</customfieldvalue>

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