# Error during Refresh when multi-threading is enabled

**URL:** <https://community.thinkgeo.com/t/error-during-refresh-when-multi-threading-is-enabled/2659>\
**Category:** WinForms\
**Created:** [January 7, 2016, 10:46am UTC](https://community.thinkgeo.com/t/error-during-refresh-when-multi-threading-is-enabled/2659 "2016-01-07T10:46:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marko](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@Marko](https://community.thinkgeo.com/u/Marko)\
**Post date:** [January 7, 2016, 10:46am UTC](https://community.thinkgeo.com/t/error-during-refresh-when-multi-threading-is-enabled/2659/1 "2016-01-07T10:46:50Z")

</div>

Hello&nbsp;again,  
  
another&nbsp;problem&nbsp;concerning&nbsp;the&nbsp;Refresh&nbsp;when&nbsp;multithreading&nbsp;is&nbsp;enabled:  
  
Occasionally,&nbsp;the&nbsp;following&nbsp;error&nbsp;occurs:  
  
System.NullReferenceException&nbsp;occurred  
  
Message:&nbsp;Exception&nbsp;thrown:&nbsp;‘System.NullReferenceException’&nbsp;in&nbsp;DesktopEdition.dll  
  
Additional&nbsp;information:&nbsp;Der&nbsp;Objektverweis&nbsp;wurde&nbsp;nicht&nbsp;auf&nbsp;eine&nbsp;Objektinstanz&nbsp;festgelegt.  
  
\>&nbsp;DesktopEdition.dll!ThinkGeo.MapSuite.DesktopEdition.WinformsMap.dxQ=(object&nbsp;drawingOverlaysObject)&nbsp;Unknown  
  
&nbsp;&nbsp;mscorlib.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback\_Context(object&nbsp;state)&nbsp;Unknown  
  
&nbsp;&nbsp;mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext&nbsp;executionContext,&nbsp;System.Threading.ContextCallback&nbsp;callback,&nbsp;object&nbsp;state,&nbsp;bool&nbsp;preserveSyncCtx)&nbsp;Unknown  
  
&nbsp;&nbsp;mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext&nbsp;executionContext,&nbsp;System.Threading.ContextCallback&nbsp;callback,&nbsp;object&nbsp;state,&nbsp;bool&nbsp;preserveSyncCtx)&nbsp;Unknown  
  
&nbsp;&nbsp;mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()&nbsp;Unknown  
  
&nbsp;&nbsp;mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()&nbsp;Unknown  
  
&nbsp;&nbsp;mscorlib.dll!System.Threading.\_ThreadPoolWaitCallback.PerformWaitCallback()&nbsp;Unknown  
  
  
  
I&nbsp;cannot&nbsp;define&nbsp;the&nbsp;specific&nbsp;state&nbsp;in&nbsp;which&nbsp;this&nbsp;error&nbsp;occurs&nbsp;as&nbsp;it&nbsp;is&nbsp;quite&nbsp;hard&nbsp;to&nbsp;debug.&nbsp;However,&nbsp;the&nbsp;thread&nbsp;in&nbsp;which&nbsp;the&nbsp;error&nbsp;occurs,&nbsp;seems&nbsp;to&nbsp;be&nbsp;the&nbsp;one&nbsp;executing&nbsp;the&nbsp;asynchronous&nbsp;refresh.  
  
  
  
Do&nbsp;you&nbsp;have&nbsp;an&nbsp;idea&nbsp;what&nbsp;can&nbsp;cause&nbsp;the&nbsp;above&nbsp;error?  
  
Are&nbsp;PDB&nbsp;symbols&nbsp;available&nbsp;for&nbsp;debugging&nbsp;purposes?  
  
  
  
Thank&nbsp;you.

---

<div class="post-metadata">

**Author:** ![Peter](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/peter/32/19042_2.png) [@Peter](https://community.thinkgeo.com/u/Peter)\
**Post date:** [January 7, 2016, 11:01pm UTC](https://community.thinkgeo.com/t/error-during-refresh-when-multi-threading-is-enabled/2659/2 "2016-01-07T23:01:35Z")

</div>

Hi&nbsp;Marko,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Sorry&nbsp;I&nbsp;don’t&nbsp;recreate&nbsp;the&nbsp;issue.&nbsp;Could&nbsp;you&nbsp;please&nbsp;append&nbsp;more&nbsp;information&nbsp;here?&nbsp;For&nbsp;example:&nbsp;  
&nbsp;&nbsp;  
&nbsp;1.&nbsp;What’s&nbsp;version&nbsp;did&nbsp;you&nbsp;reference?&nbsp;  
&nbsp;2.&nbsp;What’s&nbsp;the&nbsp;OS?&nbsp;  
&nbsp;3.&nbsp;What’s&nbsp;the&nbsp;culture&nbsp;on&nbsp;your&nbsp;side?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Peter&nbsp;

---

<div class="post-metadata">

**Author:** ![Marko](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@Marko](https://community.thinkgeo.com/u/Marko)\
**Post date:** [January 8, 2016, 8:21am UTC](https://community.thinkgeo.com/t/error-during-refresh-when-multi-threading-is-enabled/2659/3 "2016-01-08T08:21:09Z")

</div>

Hi&nbsp;Peter,  
  
  
  
I&nbsp;also&nbsp;failed&nbsp;at&nbsp;creating&nbsp;an&nbsp;example&nbsp;solution&nbsp;where&nbsp;the&nbsp;problem&nbsp;is&nbsp;reproducible.&nbsp;However,&nbsp;in&nbsp;our&nbsp;big&nbsp;application,&nbsp;it&nbsp;still&nbsp;occurs&nbsp;and&nbsp;I&nbsp;need&nbsp;to&nbsp;debug&nbsp;it.  
  
  
  
Concerning&nbsp;your&nbsp;questions:  
  
1.&nbsp;I&nbsp;use&nbsp;version&nbsp;9.0.0.190&nbsp;of&nbsp;the&nbsp;map&nbsp;suite.  
  
2.&nbsp;Windows&nbsp;7&nbsp;SP1  
  
3.&nbsp;German&nbsp;culture  
  
  
  
Do&nbsp;you&nbsp;know&nbsp;whether&nbsp;PDBs&nbsp;are&nbsp;available?&nbsp;It&nbsp;might&nbsp;really&nbsp;help&nbsp;to&nbsp;know&nbsp;what&nbsp;reference&nbsp;exactly&nbsp;is&nbsp;not&nbsp;set&nbsp;that&nbsp;causes&nbsp;the&nbsp;NullReferenceException.  
  
  
  
Thanks,  
  
Marko

---

<div class="post-metadata">

**Author:** ![Peter](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/peter/32/19042_2.png) [@Peter](https://community.thinkgeo.com/u/Peter)\
**Post date:** [January 10, 2016, 9:48pm UTC](https://community.thinkgeo.com/t/error-during-refresh-when-multi-threading-is-enabled/2659/4 "2016-01-10T21:48:05Z")

</div>

Hi&nbsp;Marko,&nbsp;  
  
  
  
Thanks&nbsp;for&nbsp;your&nbsp;more&nbsp;information.&nbsp;I&nbsp;try&nbsp;to&nbsp;recreate&nbsp;the&nbsp;issue&nbsp;based&nbsp;on&nbsp;the&nbsp;information,&nbsp;but&nbsp;I’m&nbsp;sorry&nbsp;to&nbsp;say&nbsp;that&nbsp;I&nbsp;was&nbsp;failed&nbsp;to&nbsp;do&nbsp;that.&nbsp;&nbsp;  
  
  
  
There&nbsp;are&nbsp;no&nbsp;any&nbsp;PDBs&nbsp;available&nbsp;for&nbsp;our&nbsp;publishing&nbsp;DLLs.&nbsp;Please&nbsp;try&nbsp;turning&nbsp;on&nbsp;the&nbsp;Exceptions(DEBUGS&nbsp;-\>&nbsp;Exceptions…)&nbsp;in&nbsp;vs&nbsp;IDE&nbsp;to&nbsp;get&nbsp;more&nbsp;information&nbsp;about&nbsp;the&nbsp;exception&nbsp;if&nbsp;possible.&nbsp;  
  
  
  
I&nbsp;want&nbsp;to&nbsp;confirm&nbsp;somethings&nbsp;from&nbsp;your&nbsp;reply,&nbsp;I&nbsp;just&nbsp;outline&nbsp;them&nbsp;as&nbsp;following:&nbsp;  
  
  
  
1.&nbsp;What&nbsp;did&nbsp;you&nbsp;do&nbsp;on&nbsp;the&nbsp;map&nbsp;when&nbsp;the&nbsp;exception&nbsp;occurs?&nbsp;&nbsp;  
  
2.&nbsp;What&nbsp;are&nbsp;the&nbsp;formats&nbsp;and&nbsp;size&nbsp;of&nbsp;data&nbsp;your&nbsp;application&nbsp;uses?&nbsp;  
  
  
  
Some&nbsp;code&nbsp;snippets&nbsp;attached&nbsp;here&nbsp;would&nbsp;be&nbsp;better.&nbsp;  
  
  
  
Thanks,&nbsp;  
  
Peter

---

<div class="post-metadata">

**Author:** ![Marko](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@Marko](https://community.thinkgeo.com/u/Marko)\
**Post date:** [January 14, 2016, 5:09am UTC](https://community.thinkgeo.com/t/error-during-refresh-when-multi-threading-is-enabled/2659/5 "2016-01-14T05:09:25Z")

</div>

Hello,  
  
  
  
I&nbsp;guess&nbsp;it&nbsp;was&nbsp;some&nbsp;locking&nbsp;issue.&nbsp;I&nbsp;introduced&nbsp;read/write&nbsp;locking&nbsp;during&nbsp;overlay&nbsp;access&nbsp;and&nbsp;now&nbsp;the&nbsp;error&nbsp;does&nbsp;not&nbsp;occur&nbsp;any&nbsp;more.  
  
Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;help.  
  
  
  
Marko

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [January 14, 2016, 8:15pm UTC](https://community.thinkgeo.com/t/error-during-refresh-when-multi-threading-is-enabled/2659/6 "2016-01-14T20:15:05Z")

</div>

Hi&nbsp;Marko,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;am&nbsp;glad&nbsp;to&nbsp;hear&nbsp;you&nbsp;solved&nbsp;that&nbsp;and&nbsp;thanks&nbsp;for&nbsp;your&nbsp;sharing.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don
