<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:14 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-577] MongoDB.BSON.dll does not Serialize System.Diagnostics.EventlogEntry</title>
                <link>https://jira.mongodb.org/browse/CSHARP-577</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;I&apos;m trying to insert an EventLogEntry into a MongoDB collection. I get the following exception:&lt;/p&gt;

&lt;p&gt;MongoDB.Bson.BsonSerializationException was unhandled&lt;br/&gt;
  Message=No serializer found for type System.ComponentModel.ISite.&lt;br/&gt;
  Source=MongoDB.Bson&lt;br/&gt;
  StackTrace:&lt;br/&gt;
       at MongoDB.Bson.Serialization.BsonSerializer.LookupSerializer(Type type) in C:\work\rstam\mongo-csharp-driver\Bson\Serialization\BsonSerializer.cs:line 594&lt;br/&gt;
       at MongoDB.Bson.Serialization.BsonMemberMap.GetSerializer(Type actualType) in C:\work\rstam\mongo-csharp-driver\Bson\Serialization\BsonMemberMap.cs:line 309&lt;br/&gt;
       at MongoDB.Bson.Serialization.BsonClassMapSerializer.SerializeMember(BsonWriter bsonWriter, Object obj, BsonMemberMap memberMap) in C:\work\rstam\mongo-csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs:line 546&lt;br/&gt;
       at MongoDB.Bson.Serialization.BsonClassMapSerializer.Serialize(BsonWriter bsonWriter, Type nominalType, Object value, IBsonSerializationOptions options) in C:\work\rstam\mongo-csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs:line 396&lt;br/&gt;
       at MongoDB.Bson.Serialization.BsonSerializer.Serialize(BsonWriter bsonWriter, Type nominalType, Object value, IBsonSerializationOptions options) in C:\work\rstam\mongo-csharp-driver\Bson\Serialization\BsonSerializer.cs:line 819&lt;br/&gt;
       at MongoDB.Driver.Internal.MongoInsertMessage.AddDocument(Type nominalType, Object document) in C:\work\rstam\mongo-csharp-driver\Driver\Internal\MongoInsertMessage.cs:line 58&lt;br/&gt;
       at MongoDB.Driver.MongoCollection.InsertBatch(Type nominalType, IEnumerable documents, MongoInsertOptions options) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCollection.cs:line 1155&lt;br/&gt;
       at MongoDB.Driver.MongoCollection.Insert(Type nominalType, Object document, MongoInsertOptions options) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCollection.cs:line 999&lt;br/&gt;
       at MongoDB.Driver.MongoCollection.Insert(Type nominalType, Object document) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCollection.cs:line 983&lt;br/&gt;
       at MongoDB.Driver.MongoCollection.Insert&lt;span class=&quot;error&quot;&gt;&amp;#91;TNominalType&amp;#93;&lt;/span&gt;(TNominalType document) in C:\work\rstam\mongo-csharp-driver\Driver\Core\MongoCollection.cs:line 947&lt;br/&gt;
       at ConsoleApplication2.Program.Main() in c:\Users\zippy\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\Program.cs:line 23&lt;br/&gt;
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)&lt;br/&gt;
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)&lt;br/&gt;
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()&lt;br/&gt;
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)&lt;br/&gt;
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)&lt;br/&gt;
       at System.Threading.ThreadHelper.ThreadStart()&lt;br/&gt;
  InnerException: &lt;/p&gt;


&lt;p&gt;I realize this is trivial to work around by creating a PODO with all the event log properties. It would be nice if EventLog serialization would &quot;just work&quot; though.&lt;/p&gt;

&lt;p&gt;Test code:&lt;/p&gt;


&lt;p&gt;using System.Diagnostics;&lt;br/&gt;
using MongoDB.Driver;&lt;/p&gt;

&lt;p&gt;namespace ConsoleApplication2&lt;br/&gt;
{&lt;br/&gt;
    class Program&lt;br/&gt;
    {&lt;br/&gt;
        private static MongoServer server = MongoServer.Create(&quot;mongodb://localhost/?safe=true&quot;);&lt;br/&gt;
        private static MongoDatabase db = server&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;EventLogs&amp;quot;&amp;#93;&lt;/span&gt;;&lt;br/&gt;
        static void Main()&lt;br/&gt;
        {&lt;br/&gt;
            foreach(var log in EventLog.GetEventLogs())&lt;br/&gt;
            {&lt;br/&gt;
                var logName = string.Format(&quot;EventLogs.&lt;/p&gt;
{0}
&lt;p&gt;.&lt;/p&gt;
{1}
&lt;p&gt;&quot;, log.MachineName, log.LogDisplayName);&lt;br/&gt;
                var collection = db&lt;span class=&quot;error&quot;&gt;&amp;#91;logName&amp;#93;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;                foreach (var entry in log.Entries)&lt;/p&gt;
                {
                    // Collection gets thrown here:
                    collection.Insert(entry);
                }
&lt;p&gt;            }&lt;br/&gt;
        }&lt;br/&gt;
    }&lt;br/&gt;
}&lt;/p&gt;</description>
                <environment>.NET 4.0 Visual Studio 2010</environment>
        <key id="51205">CSHARP-577</key>
            <summary>MongoDB.BSON.dll does not Serialize System.Diagnostics.EventlogEntry</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="zippy1981">Justin Dearing</reporter>
                        <labels>
                            <label>serialization</label>
                    </labels>
                <created>Sun, 23 Sep 2012 15:36:32 +0000</created>
                <updated>Thu, 20 Mar 2014 14:35:34 +0000</updated>
                            <resolved>Sun, 23 Sep 2012 19:46:15 +0000</resolved>
                                    <version>1.6</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="167167" author="craiggwilson" created="Sun, 23 Sep 2012 19:46:15 +0000"  >&lt;p&gt;Duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-564&quot; title=&quot;Serialization fails if property declared as an interface has a value of null&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-564&quot;&gt;&lt;del&gt;CSHARP-564&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="167165" author="zippy1981" created="Sun, 23 Sep 2012 19:35:43 +0000"  >&lt;p&gt;Disregard, this has been fixed post 1.6 release.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="49972">CSHARP-564</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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|hrizdj:</customfieldvalue>

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