.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

System.runtime caching on the desktop

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :.NET Framework

I have been using entlib caching application block on a windows client. Entlib caching has become a legacy app since the inclusion of caching in runtime. I am trying to migrate my code because it seems the right thing to do, but also because unlike Entlib, the runtime version allows me the opportunity to update cache items before they are evicted from the cache. Unfortunately I can't make it work.

I am using MemoryCache.

1. MemoryCache.Add throws when policy includes an update callback. It says UpdateCallback must be null. Must be a bug. MemoryCache.Set works.

2. SlidingExpiration does not slide - it is absolute.

3. As I read the docs, the update callback method can replace the item to be removed by setting the UpdatedCacheItem property, but it doesn't

4. The fact there is no documentation does not help and is inexcusable.

Am I looking at this in completely the wrong way?

Here is a test rig:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Caching;
using System.Threading;


View Complete Post

More Related Resource Links

System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Excel cannot open or save any mo


Hello good people, 

I have this beast as an error. Did my research and found some posts here as well but did not do any good for me. 

Here is what I did. I had an error regarding issue rights with COM objects so I gave access rights under component services for Microsoft Excel application now I am getting this error. 

Here is some information regarding this

1. Gave rights to ASPNET and network service to my web app directory to try to fix this error. 

2. The exact same process works on my Windows 2003 server and my Windows 7 development machine. I am trying to get this going on a different windows 2003 machine that is outside of our domain.

3. Developing on windows 7 64 bit with office 2010 installed. Also excel 2010 is installed on my Web server

4. Here is the code that is causing the error: The last line is causing the error.:

            MyXl = new Microsoft.Office.Interop.Excel.Application();
            MyXl.Visible = false;
            MyWb = (Microsoft.Office.Interop.Excel._Workbook)(MyXl.Workbooks.Add(Missing.Value));
            int test = 0; 
            MySheet = (Microsoft.Office.Interop.Excel._Worksheet)MyXl.ActiveSheet;
            if (reader.HasRows)
                int InRow = 2; 
                for (int i = 0; i < Nu

System.InvalidOperationException: Instance operation is not valid on workflow runtime thread

Am getting the exception related in the title of this article when using the StateMachineWorkflowInstance object to arbitarily set state in my workflow code; and am unsure why.  The code follows below:   500     Protected Overrides Function Execute(ByVal executionContext As System.Workflow.ComponentModel.ActivityExecutionContext) As System.Workflow.ComponentModel.ActivityExecutionStatus   501    502    506         Dim smwi As StateMachineWorkflowInstance = New StateMachineWorkflowInstance(StaticWFRuntime.LocalRuntime, Me.WorkflowInstanceId)   511    512         'set workflow-wide database connection string   513         _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString   518    519         Utility.LogEnabled()   520    521         Utility.FoaeaLogger.WriteEntry("Processing TracingApplication.Execute()....", EventLogEntryType.Information)   522         If StaticWFRuntime.LocalRuntime Is Nothing OrElse StaticWFRuntime.LocalRuntime.IsStarted = False Then   523             Utility.FoaeaLogger.WriteEntry("No static RuntimeService object exists!", EventLogEntryType.Warning)   524         End If   525    526         Return MyBase.Execute(executionContext)   527    528     End Function   796     Private Sub gotoState2_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs)   797    798        

Is it possible to Register Assembly System.Runtime.Serialization.dll

I am trying to run a Virtual Earth web service call from SQL server, and need to registier the System.Runtime.Serialization.dll assembly in SQL.  Is this possible?ThanksJay

Assembly load error system.runtime.serialization

Hello ! I have a web project which i began there is some month, and compile perfectly until now. In fact, i have some compile error;   erreur 1 Could not load file or assembly 'System.Runtime.Serialization, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest.   on explorer :   The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018) Description : Une exception non gérée s'est produite au moment de l'exécution de la demande Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code. Détails de l'exception: System.BadImageFormatException: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018) Erreur source: Une exception non gérée s'est produite lors de l'exécution de la demande Web actuelle. Les informations relatives à l'origine et l'emplacement de l'exception peuvent être identifiées en utilisant la trace de la pile d'exception ci-dessous. Trace de la pile: [BadImageFormatException: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)] System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBa

system.runtime.serialization 3.0 missing

Trying to install an app that apparently needs system.runtime.serialization 3.0 installed. I tried downloading the 3.0 framework and installing that - but it wont let me install it. Says i need to install that through the role management tool. This is on a win2k8 r2 web server. Also need system.IdentityModel 3.0  - might need others as well, not sure. So whats the correct way to get this on there? thanks

the type initializer for 'system.runtime.remoting.identity' threw an exception.

HI, I am trying to implement kerberos delegation in Active Directory enviroment with windows 2003 servers SP2. I have Client, ProxyServer and RemoteServer application that are developed on .Net framework v3.5 using .Net Remoting "System.Runtime.Remoting". I am not using Microsoft.Samples.Security.SSPI &  Microsoft.Samples.Runtime.Remoting.Security directly. my code is based on "http://blogs.msdn.com/dotnetremoting/archive/2006/07/06/662599.aspx" Only change that I have done is put impersonate="true" in channel configuration of ProxyServer and RemoteServer, and of course changed the UPN and Port and IP address. The Client's credentials are successfully impersonated by ProxyServer, I can access the text file on ProxyServer on behalf of client. But when from ProxyServer I try to execute the method on RemoteServer it throws "the type initializer for 'system.runtime.remoting.identity' threw an exception." After looking at blog http://www.secnewsgroups.net/group/microsoft.public.dotnet.security/topic8251.aspx I did required changing under Local Security Settings -> Local Policies -> User Rights Assignments -> impersonate a client after authentication and Create Global Objects. I have added three domain user names in three machine under whose credentials corrosponding application is running. When i run three applications on their

System.Runtime.InteropServices.COMException with Event Handlers

hi,           i have written an ItemDeleting Event handler for a document library which holds images. the itemdeleting eventhandler works fine and displays the  errormessage on sharepoint error page when properties.cancel=true and properties.ErrorMessage="This Image is still being used in Announcements. Cannot Delete. ". this works fine when i delete from the doclibrary itself. when i delete the images in the document library from the ImageManger Tool of RadEditor it throws the com exception as follows instead of the sharepoint error page Server Error in '/' Application. -------------------------------------------------------------------------------- This Image is still being used in Announcements. Cannot Delete. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: This Image is still being used in Announcements. Cannot Delete. can anyone suggest, how to reslove this issue.? i have the screenshots,which would better explain but i dont know how to paste images into this forum? kindly let me know how to upload images to this forums also. thank you all

System.Workflow.Runtime.Hosting.PersistenceException Timeout expired.

Is there a way for me to set the CommandTimeout property on the SqlCommand. I can see that there is a DbResourceAllocator that has a NewCommand that creates the SqlCommand but there is now way that I can change the CommandTimeout property. My workflow is quite large and I am save the Tracking information as well with the SharedConnectionWorkflowCommitWorkBatchService. These are the service that I load: string connectionString = ConfigurationManager.ConnectionStrings["DBConnectionWorkflowTracking"].ConnectionString; SqlWorkflowPersistenceService persistenceService = new SqlWorkflowPersistenceService(connectionString); persistenceService.EnableRetries = true; wr.AddService(persistenceService); SqlTrackingService sqlTrackingService = new SqlTrackingService(connectionString); sqlTrackingService.PartitionOnCompletion = true; sqlTrackingService.EnableRetries = true; wr.AddService(sqlTrackingService); SharedConnectionWorkflowCommitWorkBatchService wb = new SharedConnectionWorkflowCommitWorkBatchService(connectionString); wb.EnableRetries = true; wr.AddService(wb); wr.AddService(new CallWorkflowService()); wr.AddService(new CallWorkflowWorkflowLoaderService()); Can anyone help? Thanks Gert   

visual studio tools for the office system 3.0 runtime setup

Hi, I downloaded "visual studio tools for the office system 3.0 runtime" and installed in my machine.Now when I try to re-install this I get the message asking for "Repair" and "Uninstall" ,but non of this options are selected.Generally "Repair" used to be the default selection on re-installation for any setup installation. Do we have any way to enable this. Thanks, Deb

SSIS package fails giving "System.Runtime.InteropServices.COMException" exception


I am trying to execute the package in SQL Server 2008 and i am getting this error.


Executed as user: sql\SYSTEM. Microsoft (R) SQL Server Execute Package Utility  Version 10.0.2531.0 for 32-bit  Copyright (C) Microsoft Corp 1984-2005. All rights reserved.    

Started:  11:07:09 AM  Error: 2010-09-20 11:07:10.95     Code: 0x00000000     Source: Transform Data Task  undefined      

Description: System.Runtime.InteropServices.COMException (0x80040428): Package failed because Step 'DTSStep_DTSDataPumpTask_1' failed.     at DTS.PackageClass.Execute()     at Microsoft.SqlServer.Dts.Tasks.Exec80PackageTask.Exec80PackageTask.ExecuteThread()  End Error  DTExec: 

The package execution returned DTSER_FAILURE (1).  Started:  11:07:09 AM  Finished: 11:07:10 AM  Elapsed:  1.094 seconds.  The package execution failed.  The step failed.


Do any one have a clue


Remoting is hung up in System.Runtime.Remoting.Channels.Http.HttpServerChannel.Listen() and is not a


Hi Everyone,

We have an application that is structured as follows.

WtWindows : a remoting server that runs a exposes 2 singleton objects . We are using HTTP channels

Office Addin : This addin runs in Word , Powerpoint and Excel.

Recently a customer reported that the office and wtwindows had hung and the only way to get out of it was to restart all these applications.

The dumps from the customer show the following

<there is more in the stack trace here which is removed for clarity >

041fee74 037eda18 ParametricTechnology.Windchill.Msoi.WTWindows.ClientConnection.SetActiveDocumentInfo(System.String, System.String, IntPtr)
041ff2b8 79e71b4c [HelperMethodFrame_PROTECTOBJ: 041ff2b8] System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr, System.Object[], System.Object, Int32, Boolean, System.Object[] ByRef)
041ff3fc 79279583 System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(System.RuntimeMethodHandle, System.Object[], System.Object, Int32, Boolean, System.Object[] ByRef)
041ff420 7927039b System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, Int32, Boolean)
041ff47c 7927024c System.

System.Runtime.InteropServices.COMException (0x800A141F): Word was unable to read this document. It



I am using the Interop.word.dll in my project to generate word reports. Reports are getting with out any exception if am using 2003 ms word. If i am using 2007 word iam getting the error as


System.Runtime.InteropServices.COMException (0x800A141F): Word was unable to read this document.  It may be corrupt


Please help to get reports work well in word 2007 also.




A first chance exception of type 'System.Runtime.InteropServices.COMException'


After calling a very simple WCF Service I bind the result an Observable Collection of Countries to WPF ComboBox, in second ComboBox of cities I displayed the filtered cities based on the selected country. It works fine the first time but when I select another country it takes lots of time to display, the Visual Studio 2010 output displays this like 50 times:

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Intereting to point out that it only happens if I try to open the ComboBox and not if if navigate through code doing something like SelectedIndex=2 . It does not happen as well if instead of the ComboBox I use a ListBox or TreeView.

Some extra details.... the real exception detail is:

An event was unable to invoke any of the subscribers (Exception from HRESULT: 0x80040201)

Please help with this bug....

System.Workflow.Runtime.QueueException + SPWorkflowExternalDataExchangeService



I have implemented a WorkFlow Service part of a state machine workFlow and time to time I get an error :

Engine RunWorkflow: System.Workflow.Activities.EventDeliveryFailedException: Event "EmailOfferReceivedWorkflow" on interface type "OnBoardingStateWorkFlow.IEmailOfferWorkFlowService" for instance id "c67fc126-729f-4a61-802e-ac09b26282c3" cannot be delivered. ---> System.Workflow.Runtime.QueueException: Queue 'Message Properties  Interface Type:OnBoardingStateWorkFlow.IEmailOfferWorkFlowService  Method Name:EmailOfferReceivedWorkflow  CorrelationValues:  ' is not enabled.

Any idea ?






ReportServicesConfigUI.WMIProvider.WMIProviderException: System.Runtime.InteropServices.COMException


Hi there!

I installed the Sql Reporting Services under Vista Business.

When i run de configuration tool, i have to select yhe machine name and instance name... then when i press connect this exception is thrown


ReportServicesConfigUI.WMIProvider.WMIProviderException: A WMI error has occurred and no additional error information is available. ---> System.Runtime.InteropServices.COMException (0x8000000A)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Management.ManagementObject.InvokeMethod(String methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
   at ReportServicesConfigUI.WMIProvider.RSInstance.RefreshServerStatus()
   --- End of inner exception stack trace ---
   at ReportServicesConfigUI.WMIProvider.RSInstance.RefreshServerStatus()
   at ReportServicesConfigUI.WMIProvider.RSInstance.get_DelayLoadConfiguration()
   at ReportServicesConfigUI.WMIProvider.RSInstance.get_Item(ConfigurationItemNames itemName)
   at ReportServicesConfigUI.ConfigurationManager.ResetStepStatus()
   at ReportServicesConfigUI.ConfigurationManager.ChangeMachine()
   at ReportServicesConfigUI.ConfigurationManager.LaunchDialog()
   at ReportServicesConfigUI.ConfigurationManager.tsbConnect_Cl

.NET Runtime 2.0 Error Reporting event id 5000 system.nullreferenceexception


I only found http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=389835&SiteID=17 regarding this error message and it was of no help to me.

Background: 3rd party program that extracts users from a AD group and manage user creation i a MSSQL 2000 server. Also sends e-mails using the SMTP service. The funny thing is that the program manages everything correctly, but writes an error in the Event log as it exists (below). Job is scheduled with the SQL server agent and runs with a doamin user that has local admin rights. We have the same setup on a testserver where it runs without problems.

Windows server 2003, MDAC 2.8, SQL Server 2000 SP3, .NET framework 2 on both servers.

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 5000
Date:  2006-08-29
Time:  09:16:28
User:  N/A
Computer: STHPS0125
EventType clr20r3, P1 bzadbatch.exe, P2, P3 44e5c349, P4 bzadbatch, P5, P6 44e5c349, P7 25, P8 308, P9 system.nullreferenceexception, P10 NIL.

For more information, see Help and Support Center at

Error warming up the worker process. - Inner Exception: System.Runtime.Remoting.RemotingException: 4

Can anybody guide me how to resolve this,

10/16/2010 01:50:32.39 SPUCHostService.exe (0x0AA4)             0x0D9C SharePoint Foundation         Sandboxed Code Service         fe8d Medium   -  - Error warming up the worker process. - Inner Exception: System.Runtime.Remoting.RemotingException: 4 arguments were passed to 'Microsoft.SharePoint.UserCode.ISPUserCodeWorkerProcessProxy::Initialize'. 3 arguments were expected by this method.    Server stack trace:      at System.Runtime.Remoting.Messaging.Message.CoerceArgs(MethodBase mb, Object[] args, ParameterInfo[] pi)     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend