<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic GeodatabaseFeatureTable.AddAttachmentAsync() Is Failing if Attachments Not Synced in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250167#M2913</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm getting a null reference exception on GeodatabaseFeatureTable.AddAttachmentAsync().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var table = _gdb.GetFeatureTableById(layerId);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var feature = (GeodatabaseFeature)await table.QueryAsync(featureId);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var canAddAttachment = table.CanAddAttachment(feature); // Returns true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var hasAttachments = table.HasAttachments; // Returns true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var result = await table.AddAttachmentAsync(featureId, options.Data, options.FileName, options.ContentType); // Null reference exception&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The null reference exception is happening inside AddAttachmentAsync(). Interestingly, both CanAddAttachment() and HasAttachments both return true even if the table does not have any attachments synced. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If attachments are included when the geodatabase is generated, then all is well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But... it seems like users should not be forced to take attachments offline in order to add new attachments. There could be *a lot* of attachment data, and therefore this could really bloat download size and storage space requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any event, if this is not possible (though it would be nice if it was), a better error message other than a null reference exception would be nice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Dec 2015 20:11:47 GMT</pubDate>
    <dc:creator>JeffSiemens</dc:creator>
    <dc:date>2015-12-02T20:11:47Z</dc:date>
    <item>
      <title>GeodatabaseFeatureTable.AddAttachmentAsync() Is Failing if Attachments Not Synced</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250167#M2913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm getting a null reference exception on GeodatabaseFeatureTable.AddAttachmentAsync().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var table = _gdb.GetFeatureTableById(layerId);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var feature = (GeodatabaseFeature)await table.QueryAsync(featureId);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var canAddAttachment = table.CanAddAttachment(feature); // Returns true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var hasAttachments = table.HasAttachments; // Returns true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var result = await table.AddAttachmentAsync(featureId, options.Data, options.FileName, options.ContentType); // Null reference exception&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The null reference exception is happening inside AddAttachmentAsync(). Interestingly, both CanAddAttachment() and HasAttachments both return true even if the table does not have any attachments synced. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If attachments are included when the geodatabase is generated, then all is well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But... it seems like users should not be forced to take attachments offline in order to add new attachments. There could be *a lot* of attachment data, and therefore this could really bloat download size and storage space requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In any event, if this is not possible (though it would be nice if it was), a better error message other than a null reference exception would be nice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Dec 2015 20:11:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250167#M2913</guid>
      <dc:creator>JeffSiemens</dc:creator>
      <dc:date>2015-12-02T20:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: GeodatabaseFeatureTable.AddAttachmentAsync() Is Failing if Attachments Not Synced</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250168#M2914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume 'options' isn't null? Could you share the full stacktrace?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Dec 2015 00:25:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250168#M2914</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2015-12-05T00:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: GeodatabaseFeatureTable.AddAttachmentAsync() Is Failing if Attachments Not Synced</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250169#M2915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;'options' is not null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the stack trace:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System.NullReferenceException: Object reference not set to an instance of an object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at RuntimeCoreNet.BinaryReaderExtensions.ReadIntPtr(BinaryReader r)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at RuntimeCoreNet.CoreFeatureSource.AddAttachment(Int64 featureID, CoreAttachment coreAttachment)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at Esri.ArcGISRuntime.Data.ArcGISFeatureTable.&amp;lt;AddAttachmentAsync&amp;gt;d__23.MoveNext()&lt;/P&gt;&lt;P&gt;--- End of stack trace from previous location where exception was thrown ---&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; at GeocortexApp.WinForms.Runtime.RuntimeReplicaProvider.&amp;lt;AddAttachment&amp;gt;d__18.MoveNext() in C:\svn\GeocortexApp\_Trunk\GeocortexApp.WinForms\Runtime\RuntimeReplicaProvider.cs:line 560&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Dec 2015 22:50:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250169#M2915</guid>
      <dc:creator>JeffSiemens</dc:creator>
      <dc:date>2015-12-07T22:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: GeodatabaseFeatureTable.AddAttachmentAsync() Is Failing if Attachments Not Synced</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250170#M2916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had the same problem!&lt;/P&gt;&lt;P&gt; After setting the parmater ReturnAttachments to true in &lt;SPAN style="color: #2b91af;"&gt;GenerateGeodatabaseParameters&lt;/SPAN&gt; it seems to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt; gdbParams = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af;"&gt;GenerateGeodatabaseParameters&lt;/SPAN&gt;(layerHandler.LayerIds, sverigeExtent)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OutSpatialReference = sverigeExtent.SpatialReference,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SyncModel = &lt;SPAN style="color: #2b91af;"&gt;SyncModel&lt;/SPAN&gt;.PerLayer,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LayerQueries = layerQueryDictionary,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReturnAttachments = &lt;SPAN style="color: blue;"&gt;true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Arne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jan 2016 15:05:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250170#M2916</guid>
      <dc:creator>ArneDahlman</dc:creator>
      <dc:date>2016-01-15T15:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: GeodatabaseFeatureTable.AddAttachmentAsync() Is Failing if Attachments Not Synced</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250171#M2917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right, but having to download all attachments in order to add new attachments is crazy. This could lead to massively bloated downloads, or out-right failures if the replica is too big for ArcGIS Server to generate. Hopefully this will be addressed with the Quartz release?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 01:11:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250171#M2917</guid>
      <dc:creator>JeffSiemens</dc:creator>
      <dc:date>2016-01-21T01:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: GeodatabaseFeatureTable.AddAttachmentAsync() Is Failing if Attachments Not Synced</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250172#M2918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you dont need the whole layer you can add filter statments to the checkout paramters.&lt;BR /&gt;If you need the whole layer, but not the images, and you still want to be able to add new images...&lt;BR /&gt;Then I think you will have to do this in a different way or hope for new functionality in the future.&lt;BR /&gt;Maybe you can store the new images with the featureids separately and handle this at checkin time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 06:51:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/geodatabasefeaturetable-addattachmentasync-is/m-p/250172#M2918</guid>
      <dc:creator>ArneDahlman</dc:creator>
      <dc:date>2016-01-21T06:51:05Z</dc:date>
    </item>
  </channel>
</rss>

