- Download tar.gz https://www.jetbrains.com/pycharm/download/download-thanks.html?platform=linuxARM64
- Extract
- sudo ln -s /usr/lib64/libglib-2.0.so.0 /usr/lib64/libgthread-2.0.so.0
- sudo ln -s /usr/lib64/libglib-2.0.so.0 /usr/lib64/libgthread-2.0.so
- ./{extraction_folder}/bin/pycharm
2026-03-01
PyCharm 2025.3.3 on OpenSUSE aarch64
2019-09-22
FeedCacheService.IsRepopulationNeeded
I've noticed on my dev farm error 6398 in the application event log which happens only periodically:
The Execute method of job definition Microsoft.Office.Server.UserProfiles.LMTRepopulationJob (ID 59afb507-292a-40d1-97c3-0a038c9bf0e1) threw an exception. More information is included below.
Unexpected exception in FeedCacheService.IsRepopulationNeeded: Cache cluster is down, restart the cache cluster and Retry.
In ULS I found more details about the error:
Unexpected error occurred in method 'GetObject' , usage 'FeedCache' - Exception 'Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.) ---> System.ServiceModel.CommunicationException: The socket was aborted because an asynchronous receive from the socket did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. ---> System.IO.IOException: The write operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: The socket was aborted because an asynchronous receive from the socket did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. ---> System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Sockets.Socket'.
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) -
-- End of inner exception stack trace ---
at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
at System.ServiceModel.Channels.BufferedConnection.WriteNow(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, BufferManager bufferManager)
at System.ServiceModel.Channels.BufferedConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) -
-- End of inner exception stack trace ---
at System.Net.Security.NegotiateStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.ServiceModel.Channels.StreamConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) -
-- End of inner exception stack trace ---
at System.ServiceModel.Channels.StreamConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
at System.ServiceModel.Channels.StreamConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout, BufferManager bufferManager)
at System.ServiceModel.Channels.FramingDuplexSessionChannel.OnSendCore(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.OnSend(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout)
at Microsoft.ApplicationServer.Caching.CacheResolverChannel.Send(Message message, TimeSpan timeout)
at Microsoft.ApplicationServer.Caching.WcfClientChannel.SendOnChannel(EndpointID endpoint, TimeSpan& timeout, WaitCallback callback, Object state, Boolean async, IDuplexSessionChannel channel, Message message) -
-- End of inner exception stack trace ---
at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, RequestBody reqBody)
at Microsoft.ApplicationServer.Caching.DataCache.InternalGet(String key, DataCacheItemVersion& version, String region, IMonitoringListener listener)
at Microsoft.ApplicationServer.Caching.DataCache.<>c__DisplayClass51.<Get>b__50()
at Microsoft.Office.Server.DistributedCaching.SPDistributedCache.GetObject(String key, String regionName)'.
As per the post on Premier Field Engineering Developer Blog, this is a generic error. In order to get additional details, logging should be enabled on Distributed cache service's config file (for me it was C:\Program Files\AppFabric 1.1 for Windows Server\DistributedCacheService.exe.config):
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\Temp\DistributedCacheService.svclog" />
</listeners>
</source>
</sources>
<trace autoflush="true" />
</system.diagnostics>
I restarted the Distributed cache service and now I am waiting for another instance of the error to happen so I can get the details of the actual exception.
EDIT: Nothing useful found in trace log. I've enabled verbose log for SharePoint Server > Distributed Cache.
EDIT2: I've enabled admin and debug event logs for distributed cache service.
The Execute method of job definition Microsoft.Office.Server.UserProfiles.LMTRepopulationJob (ID 59afb507-292a-40d1-97c3-0a038c9bf0e1) threw an exception. More information is included below.
Unexpected exception in FeedCacheService.IsRepopulationNeeded: Cache cluster is down, restart the cache cluster and Retry.
In ULS I found more details about the error:
Unexpected error occurred in method 'GetObject' , usage 'FeedCache' - Exception 'Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0017>:SubStatus<ES0006>:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.) ---> System.ServiceModel.CommunicationException: The socket was aborted because an asynchronous receive from the socket did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. ---> System.IO.IOException: The write operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: The socket was aborted because an asynchronous receive from the socket did not complete within the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. ---> System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Sockets.Socket'.
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) -
-- End of inner exception stack trace ---
at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
at System.ServiceModel.Channels.BufferedConnection.WriteNow(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, BufferManager bufferManager)
at System.ServiceModel.Channels.BufferedConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) -
-- End of inner exception stack trace ---
at System.Net.Security.NegotiateStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.ServiceModel.Channels.StreamConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) -
-- End of inner exception stack trace ---
at System.ServiceModel.Channels.StreamConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)
at System.ServiceModel.Channels.StreamConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout, BufferManager bufferManager)
at System.ServiceModel.Channels.FramingDuplexSessionChannel.OnSendCore(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.OnSend(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout)
at Microsoft.ApplicationServer.Caching.CacheResolverChannel.Send(Message message, TimeSpan timeout)
at Microsoft.ApplicationServer.Caching.WcfClientChannel.SendOnChannel(EndpointID endpoint, TimeSpan& timeout, WaitCallback callback, Object state, Boolean async, IDuplexSessionChannel channel, Message message) -
-- End of inner exception stack trace ---
at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, RequestBody reqBody)
at Microsoft.ApplicationServer.Caching.DataCache.InternalGet(String key, DataCacheItemVersion& version, String region, IMonitoringListener listener)
at Microsoft.ApplicationServer.Caching.DataCache.<>c__DisplayClass51.<Get>b__50()
at Microsoft.Office.Server.DistributedCaching.SPDistributedCache.GetObject(String key, String regionName)'.
As per the post on Premier Field Engineering Developer Blog, this is a generic error. In order to get additional details, logging should be enabled on Distributed cache service's config file (for me it was C:\Program Files\AppFabric 1.1 for Windows Server\DistributedCacheService.exe.config):
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\Temp\DistributedCacheService.svclog" />
</listeners>
</source>
</sources>
<trace autoflush="true" />
</system.diagnostics>
I restarted the Distributed cache service and now I am waiting for another instance of the error to happen so I can get the details of the actual exception.
EDIT: Nothing useful found in trace log. I've enabled verbose log for SharePoint Server > Distributed Cache.
EDIT2: I've enabled admin and debug event logs for distributed cache service.
2019-09-18
An SPPerformanceCounter was not properly disposed
I came across an unexpected error in ULS on my SharePoint 2013 development farm:
An SPPerformanceCounter was not properly disposed. This could cause excessive memory use.
I've noticed it happens immediately after Health Analysis Job (Hourly, Distributed Cache, All Servers) timer job has executed. In the ULS I also saw that the following rules are being executed by aforementioned timer job:
An SPPerformanceCounter was not properly disposed. This could cause excessive memory use.
I've noticed it happens immediately after Health Analysis Job (Hourly, Distributed Cache, All Servers) timer job has executed. In the ULS I also saw that the following rules are being executed by aforementioned timer job:
- Microsoft.SharePoint.Administration.Health.SPDistributedCacheHostDown
- Microsoft.SharePoint.Administration.Health.SPDistributedCacheHostFirewallSettingsIncorrect
- Microsoft.SharePoint.Administration.Health.SPDistributedCacheObjectEvicted
- Microsoft.SharePoint.Administration.Health.SPDistributedCacheHostApproachingThrottling
I've reflected Microsoft.SharePoint.Health.dll in order to map rules to the descriptions in CA. Each of the classes mentioned above has a property named Summary. In the getter of the property there's a key to resource, such as HealthRule_Summary_SPDistributedCacheObjectEvicted for SPDistributedCacheObjectEvicted class. Next I reflected Microsoft.SharePoint.intl.dll and searched for the keys in Microsoft.SharePoint.resources of the assembly. This is how mapping between rules (classes) and descriptions looks like:
- Microsoft.SharePoint.Administration.Health.SPDistributedCacheHostDown - One of the cache hosts in the cluster is down.
- Microsoft.SharePoint.Administration.Health.SPDistributedCacheHostFirewallSettingsIncorrect - Firewall client settings on the cache host are incorrect.
- Microsoft.SharePoint.Administration.Health.SPDistributedCacheObjectEvicted - Cached objects have been evicted.
- Microsoft.SharePoint.Administration.Health.SPDistributedCacheHostApproachingThrottling - The Current server is running low on memory.
Then I opened Central Administration (Monitoring > Review rule definitions) and ran the rules one by one while monitoring ULS real time. I found the offending rule in Microsoft.SharePoint.Administration.Health.SPDistributedCacheObjectEvicted.
Piece of code which is causing the issue is located in Microsoft.SharePoint.dll assembly, namely by the method Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheHealthRulesHelper.GetTotalObjectsEvicted(). Line 149 is causing the error:
num = (uint) new SPPerformanceCounter("AppFabric Caching:Host", "Total Evicted Objects").NextValue();
My development farm is on SP1 level. Since I can't upgrade the farm a newer version, because production farm is on that level, I had only two options to resolve the issue:
- Treat it as a false positive, i.e. ignore the error.
- Disable the rule in CA.
I chose option two. I disabled the rule in CA and ran the timer job again. There were no unexpected errors in ULS any more.
Error Event with ID=3
This morning I was greeted with the error in Application log of Event Log on my dev environment:
WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/32074454
Exception: System.ServiceModel.ServiceActivationException: The service '/_vti_bin/ServiceName/ServiceName.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'ServiceName', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.. ---> System.InvalidOperationException: The type 'ServiceName', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
Process Name: w3wp
Process ID: 17160
I double checked to see whether the type in question really is present in the assembly. I also checked to see whether this assembly has been loaded by w3wp.exe process. Nothing pointed to anything unusual.
Then I went to check IIS log and there I found out that the request returned HTTP status code 401. Turns out that during the night worker process recycled by schedule and I left the SharePoint page opened in my browser. SharePoint page contains a piece of javascript code which periodically calls WCF service deployed in _vti_bin folder. Since browser is not on the same domain as dev environment it prompted for password. There was no one there during the night to enter the password so server returned 401. Once I logged in errors went away. False positive.
WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/32074454
Exception: System.ServiceModel.ServiceActivationException: The service '/_vti_bin/ServiceName/ServiceName.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'ServiceName', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.. ---> System.InvalidOperationException: The type 'ServiceName', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
Process Name: w3wp
Process ID: 17160
I double checked to see whether the type in question really is present in the assembly. I also checked to see whether this assembly has been loaded by w3wp.exe process. Nothing pointed to anything unusual.
Then I went to check IIS log and there I found out that the request returned HTTP status code 401. Turns out that during the night worker process recycled by schedule and I left the SharePoint page opened in my browser. SharePoint page contains a piece of javascript code which periodically calls WCF service deployed in _vti_bin folder. Since browser is not on the same domain as dev environment it prompted for password. There was no one there during the night to enter the password so server returned 401. Once I logged in errors went away. False positive.
2019-09-08
Error processing policy updates
I've seen error event with Event ID 7997 in the Event log. Task category is Information Policy Management.
Error processing policy updates for site http://site for list listname.
Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Office.RecordsManagement.InformationPolicy.ListPolicySettings.get_UseListPolicy() at Microsoft.Office.RecordsManagement.InformationPolicy.Policy.<>c__DisplayClass5.<>c__DisplayClass7.b__1(SPList list) at Microsoft.Office.Server.Utilities.ContentIterator.ProcessLists(SPListCollection lists, ListProcessor listProcessor, ListProcessorErrorCallout errorCallout)
List listname is a part of custom feature.
Initial analysis points to Information management policy timer job.
Inner exception is
Arithmetic overflow error converting expression to data type int. SQL Server stored procedure: proc_GetDocsMetaInfo.
Upon further digging I found that store procedure causing the issue was dbo.proc_GetDocsMetaInfoSingle. In particular it was this part: Lists.tp_BaseType + Lists.tp_ServerTemplate * 256. This caused arithmetic overflow because Type for ListTemplate was set to a value greater than 10,000,000. Once I reduced the value error was not present any more.
This must be obeyed:
This must be obeyed:
BaseType + Type * 256 < 2^31 - 1Failure retrieving Diagnostics Logs location
I've been getting these Unexpected ULS entries from
Timer Job hourly-all-sptimerservice-health-analysis-job:Turns out I had to change Central Administration > Monitoring > Configure diagnostic logging > Path from %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\15\LOGS to C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\LOGS.Failure retrieving Diagnostics Logs location:
System.ArgumentException: Object must be a root directory ("C:\") or a drive letter ("C").
at System.IO.DriveInfo..ctor(String driveName)
at Microsoft.SharePoint.Administration.Health.AppServerDrivesAreNearlyFull. GetDrivesForValidation()
Error is caused by Health Analysis Job (Hourly, Microsoft SharePoint Foundation Timer, All Servers) timer job. Specifically DriveInfo constructor cannot resolve environment variables, so log location has to be a real path.
Alternative Powershell script solution:
$diagSvc = [Microsoft.SharePoint.Administration.SPDiagnosticsService]::Local
$commonProgramFiles = Get-ChildItem -Path Env:\ | where Name -EQ "CommonProgramFiles"
$newLogLocation = $diagSvc.LogLocation.Replace("%CommonProgramFiles%", $commonProgramFiles[0].Value)
$diagSvc.LogLocation = $newLogLocation
$diagSvc.Update()
2019-09-03
Event Log Warning Event ID 8088 - Taxonomy
I experienced a lone Warning event in the Application Event log with the ID 8088 after server restart. Text of the event was 'The Managed Metadata Service 'Managed Metadata Service Application' is inaccessible.'.
I dug deeper in ULS and found this log entry:
I dug deeper in ULS and found this log entry:
Failed to get term store for proxy 'Managed Metadata Service Application'. Exception: System.TimeoutException: The request channel timed out while waiting for a reply after 00:00:09.9375192. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The HTTP request to 'http://sp2:32843/ee1f85842acc4eb1b543bb2b1395980c/MetadataWebService.svc' has exceeded the allotted timeout of 00:00:09.9990000. The time allotted to this operation may have been a portion of a longer timeout. ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) -
-- End of inner exception stack trace ---
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) -
-- End of inner exception stack trace --- Server stack trace:
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown
at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.SharePoint.Taxonomy.Internal.IDataAccessReadOnly.GetSessionData(Guid& termStoreId, Guid rawPartitionId, Int32 lcid, String systemGroupName, String systemGroupDescription, String keywordsTermsetName, String keywordsTermsetDescription, String orphanedTermsTermsetName, String orphaneedTermsTermsetDescription, String hashtagsTermsetName, String hashtagsTermsetDescription)
at Microsoft.SharePoint.Taxonomy.Internal.TaxonomyProxyAccess.<>c__DisplayClass4.<GetSessionData>b__3(IMetadataWebServiceApplication serviceApplication)
at Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplicationProxy.<>c__DisplayClass38.<RunOnChannel>b__36()
at Microsoft.Office.Server.Security.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplicationProxy.RunOnChannel(CodeToRun codeToRun, Double operationTimeoutFactor)
at Microsoft.SharePoint.Taxonomy.Internal.TaxonomyProxyAccess.GetSessionData(Guid& termStoreId, Guid rawPartitionId, Int32 lcid, String systemGroupName, String systemGroupDescription, String keywordsTermsetName, String keywordsTermsetDescription, String orphanedTermsTermsetName, String orphanedTermsTermsetDescription, String hashtagsTermsetName, String hashtagsTermsetDescription)
at Microsoft.SharePoint.Taxonomy.Internal.DataAccessManager.GetSessionData(Guid& termStoreId)
Source of the log entry was Timer Job Query Classification Dictionary Update for Search Application.
So a web service call to Managed Metadata web service timed out after roughly 10 seconds. After a bit of digging I found out that the timer job uses C:\Program Files\Microsoft Office Servers\15.0\WebClients\Metadata\client.config for the client endpoint configuration. There I saw that both http and https bindings were set up to have timeouts set to 30 seconds. This puzzled me so I reflected the code in question. Turns out that timer job is using operationTimeoutFactor which was set to 0.333333 in my case. It multiplies the factor with timeout setting in the configuration file to get the real timeout. That's why web service call timed out after 30 * 0.333333 = 9.999 seconds.
I just increased all of the timeouts to 1:30 minutes and restarted to SharePoint Timer service. Warnings in the Event Log didn't appear any more.
C:\Program Files\Microsoft Office Servers\15.0\WebClients\Metadata\client.config after modification:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <client> <endpoint name="http" contract="Microsoft.SharePoint.Taxonomy.IMetadataWebServiceApplication" binding="customBinding" bindingConfiguration="MetadataWebServiceHttpBinding" /> <endpoint name="https" contract="Microsoft.SharePoint.Taxonomy.IMetadataWebServiceApplication" binding="customBinding" bindingConfiguration="MetadataWebServiceHttpsBinding" /> </client> <bindings> <customBinding> <binding name="MetadataWebServiceHttpBinding" receiveTimeout="00:01:30" sendTimeout="00:01:30" openTimeout="00:01:30" closeTimeout="00:01:30"> <security authenticationMode="IssuedTokenOverTransport" allowInsecureTransport="true" /> <binaryMessageEncoding> <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" /> </binaryMessageEncoding> <httpTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" authenticationScheme="Anonymous" useDefaultWebProxy="false" /> </binding> <binding name="MetadataWebServiceHttpsBinding" receiveTimeout="00:01:30" sendTimeout="00:01:30" openTimeout="00:01:30" closeTimeout="00:01:30"> <security authenticationMode="IssuedTokenOverTransport" /> <binaryMessageEncoding> <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" /> </binaryMessageEncoding> <httpsTransport transferMode="StreamedResponse" maxReceivedMessageSize="2147483647" authenticationScheme="Anonymous" useDefaultWebProxy="false" /> </binding> </customBinding> </bindings> </system.serviceModel> <system.net> <connectionManagement> <add address="*" maxconnection="10000" /> </connectionManagement> </system.net> </configuration>
2019-06-19
Failed to load receiver assembly
This is a very common issue and it manifests in Visual Studio during deploy. For me, remedy was this:
- Delete obj and bin folders of the solution.
- Restart Visual Studio.
- Set Always Force Install to true on all features.
- Deploy.
- Optionally, after successful deployment revert Always Force Install to false on all features.
2018-10-24
Getting Rid of http://server/Analytics_{GUID}/ Requests
When I'm developing software I often have Fiddler turned on to capture client HTTP traffic. I've noticed weird http://server/Analytics_{GUID}/ Requests appearing in a batch of 4 requests every minute:
Investigation led me to Application Server Administration Service Timer Job which in turn called Search Service Instance's Synchronize method. This method calls code which uses rather odd way of determining whether file share exists:
private static bool ShareExists(string path)
{
try
{
Directory.GetDirectories(path);
return true;
}
catch (UnauthorizedAccessException ex)
{
return true;
}
catch (Exception ex)
{
return false;
}
}
Line Directory.GetDirectories(path); causes those 4 requests. This execution path happens when you don't have Search Service Application provisioned but you do have SharePoint Server Search service started.
Anyway, I stopped the service using cmdlet:
Get-SPEnterpriseSearchServiceInstance -Local | Stop-SPEnterpriseSearchServiceInstance
And the problem was solved, no more pesky Analytics requests.
Investigation led me to Application Server Administration Service Timer Job which in turn called Search Service Instance's Synchronize method. This method calls code which uses rather odd way of determining whether file share exists:
private static bool ShareExists(string path)
{
try
{
Directory.GetDirectories(path);
return true;
}
catch (UnauthorizedAccessException ex)
{
return true;
}
catch (Exception ex)
{
return false;
}
}
Line Directory.GetDirectories(path); causes those 4 requests. This execution path happens when you don't have Search Service Application provisioned but you do have SharePoint Server Search service started.
Anyway, I stopped the service using cmdlet:
Get-SPEnterpriseSearchServiceInstance -Local | Stop-SPEnterpriseSearchServiceInstance
And the problem was solved, no more pesky Analytics requests.
2016-12-14
Setting Related Item on a SharePoint 2013 Worfklow's SingleTask
Sometimes when we design workflows it is necessary to set related item in SingleTask to something different than the default listitem. Default list item is the item on which workflow was started. So, lets say we start workflow on doc1.docx. Inside the workflow we define SingleTask. This SingleTask, when opened in SharePoint UI, will have, by default, a link to doc1.docx. Sometimes we would like this SingleTask to have related item which is different than that particular doc1.docx.
Microsoft has intended for this purpose SingleTask argument named RelatedContentLinkListItemIntegerId. Great, you just set the list ID and item ID and you have your problem solved. Wrong!! Setting this property will have no impact on related item. At least, not if you use default generated SingleTask activity.
The solution:
Setting RelatedContentLinkListItemIntegerId will only work if you delete a particular child element in workflow markup (XAML). So, first open your workflow in Code mode (Visual Studio View Code - F7). Then locate the SingleTask activity which you would like to configure. This should be p:SingleTask XML element. Delete p:SingleTask.RelatedContentLinkListItemId child elemet. Save your workflow and voila, it will change related item to whatever value you set it.
Microsoft has intended for this purpose SingleTask argument named RelatedContentLinkListItemIntegerId. Great, you just set the list ID and item ID and you have your problem solved. Wrong!! Setting this property will have no impact on related item. At least, not if you use default generated SingleTask activity.
The solution:
Setting RelatedContentLinkListItemIntegerId will only work if you delete a particular child element in workflow markup (XAML). So, first open your workflow in Code mode (Visual Studio View Code - F7). Then locate the SingleTask activity which you would like to configure. This should be p:SingleTask XML element. Delete p:SingleTask.RelatedContentLinkListItemId child elemet. Save your workflow and voila, it will change related item to whatever value you set it.
2016-10-07
SharePoint 2016 Application Pools and Other Processes Stop Immediately After Starting
At one point of developing SharePoint 2016 Farm solution on my dev machine SharePoint application pools, namely web application pool and CA application pool, started to crash on start. I restarted the server and then all of a sudden no SharePoint services (SharePoint Timer Service, SharePoint Tracing Service) could be started.
All google results pointed to faulty application pool account. I double checked that account was not locked and had appropriate perms. No luck there.
System Event log was full of events 5002, 5009 and 5011.
After inspecting a situation with Process Monitor we pin pointed an error to missing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\Location value in the registry. After adding C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ data to Location value all services went back online after server restart.
Only change in server configuration that day was installment of Microsoft Office Professional Plus 2016. I don't have time to investigate what caused deletion of aforementioned value in registry but I am eager to find out.
Hopefully, I will edit this post if I find out more details.
All google results pointed to faulty application pool account. I double checked that account was not locked and had appropriate perms. No luck there.
System Event log was full of events 5002, 5009 and 5011.
After inspecting a situation with Process Monitor we pin pointed an error to missing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\Location value in the registry. After adding C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ data to Location value all services went back online after server restart.
Only change in server configuration that day was installment of Microsoft Office Professional Plus 2016. I don't have time to investigate what caused deletion of aforementioned value in registry but I am eager to find out.
Hopefully, I will edit this post if I find out more details.
2016-05-02
OpenQuery Failed with status ID: 0x800007d0
ULS on my clients' farm was polluted by messages "OpenQuery Failed with status ID: 0x800007d0" every few seconds.
Turns out I had to add user which is running mssearch.exe process (SP_Search in my case) to local group called Performance Monitor Users. After adding the user I rebooted the machine and the problem went away.
Turns out I had to add user which is running mssearch.exe process (SP_Search in my case) to local group called Performance Monitor Users. After adding the user I rebooted the machine and the problem went away.
2016-02-17
Shared Folder Permissions When Running Backup-SPFarm
I have setup a farm according to Medium Security Option on Vlad Catrinescu's blog. I setup a backup of this farm using Backup-SPFarm powershell script. If I grant read/write permissions to Everyone on shared folder everything works fine. But if I limit permissions only to SP_Admin account backup fails.
The solution is to grant the following accounts read/write permissions to shared folder:
where SP_Admin is the user account which executes the script.
The solution is to grant the following accounts read/write permissions to shared folder:
- SP_Admin
- SP_Services
- SQL_Services
where SP_Admin is the user account which executes the script.
2015-12-22
NullReferenceException When Clicking a Task in Workflow Designer
The other day I was designing a Workflow (Workflow Manager technology) in Visual Studio 2012 when I stumbled upon on an exception when clicking on a SingleTask activity in Workflow Designer within Visual Studio. When I first click on a task I get "Communicating with SharePoint" dialog:
After Visual Studio establishes communication with SharePoint I end up with the following dialog:
Full exception stack trace is as follows:
-------------------------
Workflow Designer
-------------------------
NullReferenceException:
Object reference not set to an instance of an object.
-------------------------
Server stack trace:
at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointSolutionModelStorage.GetAllFiles(ISharePointProject project)
at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointSolutionModelStorage.Refresh(ISharePointProject project)
at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointCompositeModelStorage.RefreshProjectModels()
at Microsoft.VisualStudio.SharePoint.WorkflowDesignerSupport.ListInfoService.GetContentTypes(String BaseTypeId)
at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.<GetWorkflowTaskContentTypes>b__10(IListInfoService service)
at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.ConvertValues(Func`2 producer)
at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.GetWorkflowTaskContentTypes()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.SharePoint.DesignTime.Activities.Design.Services.ISharePointListService.GetWorkflowTaskContentTypes()
at Microsoft.SharePoint.DesignTime.Activities.Design.ContentTypesProvider.ProvideItems(ISharePointListService service)
at Microsoft.SharePoint.DesignTime.Activities.Design.IndependentDataProvider`1.GetItems(ModelItem owner, PropertyValue propertyValue)
at Microsoft.SharePoint.DesignTime.Activities.Design.SharePointItemChooserViewModel`1.GetItems(ModelItem Owner, PropertyValue PropertyValue)
at Microsoft.SharePoint.DesignTime.Activities.Design.ChooserViewModel`1.PopulateItems()
at Microsoft.SharePoint.DesignTime.Activities.Design.GenericChooser`2.SharePointBaseChooser_Loaded(Object sender, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.RouteItem.InvokeHandler(RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.EventRoute.InvokeHandlers(Object source, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at MS.Internal.LoadedOrUnloadedOperation.DoWork()
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
-------------------------
After a long debugging session of Workflow Designer I realized that my colleague accidentally deleted Package folder from SharePoint App project. I pulled the latest version and I didn't notice that folder was missing. When I restored the folder, Workflow Designer didn't throw any exceptions any more.
After Visual Studio establishes communication with SharePoint I end up with the following dialog:
Full exception stack trace is as follows:
-------------------------
Workflow Designer
-------------------------
NullReferenceException:
Object reference not set to an instance of an object.
-------------------------
Server stack trace:
at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointSolutionModelStorage.GetAllFiles(ISharePointProject project)
at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointSolutionModelStorage.Refresh(ISharePointProject project)
at Microsoft.VisualStudio.SharePoint.Designers.List.ModelAccess.SharePointCompositeModelStorage.RefreshProjectModels()
at Microsoft.VisualStudio.SharePoint.WorkflowDesignerSupport.ListInfoService.GetContentTypes(String BaseTypeId)
at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.<GetWorkflowTaskContentTypes>b__10(IListInfoService service)
at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.ConvertValues(Func`2 producer)
at Microsoft.VisualStudio.SharePoint.WorkflowExtensions.SharePointListService.GetWorkflowTaskContentTypes()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.SharePoint.DesignTime.Activities.Design.Services.ISharePointListService.GetWorkflowTaskContentTypes()
at Microsoft.SharePoint.DesignTime.Activities.Design.ContentTypesProvider.ProvideItems(ISharePointListService service)
at Microsoft.SharePoint.DesignTime.Activities.Design.IndependentDataProvider`1.GetItems(ModelItem owner, PropertyValue propertyValue)
at Microsoft.SharePoint.DesignTime.Activities.Design.SharePointItemChooserViewModel`1.GetItems(ModelItem Owner, PropertyValue PropertyValue)
at Microsoft.SharePoint.DesignTime.Activities.Design.ChooserViewModel`1.PopulateItems()
at Microsoft.SharePoint.DesignTime.Activities.Design.GenericChooser`2.SharePointBaseChooser_Loaded(Object sender, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.RouteItem.InvokeHandler(RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.EventRoute.InvokeHandlers(Object source, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at MS.Internal.LoadedOrUnloadedOperation.DoWork()
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
-------------------------
After a long debugging session of Workflow Designer I realized that my colleague accidentally deleted Package folder from SharePoint App project. I pulled the latest version and I didn't notice that folder was missing. When I restored the folder, Workflow Designer didn't throw any exceptions any more.
2015-12-03
Running a Project with Workflow in Provider-Hosted Add-In
While trying to run (F5 in Visual Studio) add-in project of provider-hosted add-in containing workflow I got this error in output window:
Microsoft.SharePoint.WorkflowServices
System.FormatException: RestrictAssociationToId
at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.PublishOrUpdateDefinitions(WorkflowServicesManager proxy, WorkflowDeploymentService deploymentService, Dictionary`2 oldDefinitionIdMap, Dictionary`2 newDefinitionIdMap, Dictionary`2 listIdDictionary)
at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.DeployOrUpgrade(WorkflowScopeIdentifier scopeId, SPWorkflowPart oldParts, SPWorkflowPart newParts, Dictionary`2 listIdDictionary)
at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.Deploy(WorkflowScopeIdentifier scopeId, SPWorkflowPart parts, Dictionary`2 listIdDictionary) StackTrace:
at Microsoft.Office.Server.Native.dll: (sig=678c0f87-966f-4d99-9c94-b49e788d2672|2|microsoft.office.server.native.pdb, offset=131CE)
at Microsoft.Office.Server.Native.dll: (offset=21BE5)
Turns out I didn't include target list and history list in the app feature. This caused aforementioned error while trying to deploy workflow during "Activate features" stage. As soon as I included the lists in the feature everything went ok.
Microsoft.SharePoint.WorkflowServices
System.FormatException: RestrictAssociationToId
at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.PublishOrUpdateDefinitions(WorkflowServicesManager proxy, WorkflowDeploymentService deploymentService, Dictionary`2 oldDefinitionIdMap, Dictionary`2 newDefinitionIdMap, Dictionary`2 listIdDictionary)
at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.DeployOrUpgrade(WorkflowScopeIdentifier scopeId, SPWorkflowPart oldParts, SPWorkflowPart newParts, Dictionary`2 listIdDictionary)
at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.Deploy(WorkflowScopeIdentifier scopeId, SPWorkflowPart parts, Dictionary`2 listIdDictionary) StackTrace:
at Microsoft.Office.Server.Native.dll: (sig=678c0f87-966f-4d99-9c94-b49e788d2672|2|microsoft.office.server.native.pdb, offset=131CE)
at Microsoft.Office.Server.Native.dll: (offset=21BE5)
Turns out I didn't include target list and history list in the app feature. This caused aforementioned error while trying to deploy workflow during "Activate features" stage. As soon as I included the lists in the feature everything went ok.
2015-10-06
Small Talk: SharePoint 2013 workflow : The server was unable t...
Small Talk: SharePoint 2013 workflow : The server was unable t...: Here, I received another SharePoint 2013 workflow error. This time the workflow was not able to send emails and the following error was b...
2015-09-09
Updating Workflow Definitions Without Terminating Current Instances
I haven't seen anywhere a good tutorial on how to update a workflow definition without terminating currently running instances on SharePoint 2013 Workflow Manager platform so this post is my contribution to the community. The goal of this post is to enable the following series of steps:
There are some examples on how to update Workflow Manager workflows on MSDN but these examples are strictly tied to Workflow Manager platform, not Workflow Manager in combination with SharePoint 2013. My solution is based on aforementioned MSDN article but it is adapted to SharePoint 2013.
Prerequisite for my solution is at least one deploy of the workflow using either Visual Studio deploy or using PowerShell scripts. Workflow needs to be deployed as a part of the feature only first time.
For part 1 of this post I will demonstrate how to publish new versions of workflow using console application. I also presume you are developing on development box with Visual Studio installed. In part 2 I will focus on packaging the deployment in feature receiver.
Complete solution is available for download.
List of types in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.SharePoint.DesignTime.Activities.dll assembly:
- Update workflow definition XAMLs (for example from version 1 to version 2).
- Allow currently running instances of workflow to finish running the version 1 of the workflow.
- New instances of workflow will run version 2 of the workflow. Version 1 of the workflow shouldn't be allowed to run any more.
There are some examples on how to update Workflow Manager workflows on MSDN but these examples are strictly tied to Workflow Manager platform, not Workflow Manager in combination with SharePoint 2013. My solution is based on aforementioned MSDN article but it is adapted to SharePoint 2013.
Prerequisite for my solution is at least one deploy of the workflow using either Visual Studio deploy or using PowerShell scripts. Workflow needs to be deployed as a part of the feature only first time.
For part 1 of this post I will demonstrate how to publish new versions of workflow using console application. I also presume you are developing on development box with Visual Studio installed. In part 2 I will focus on packaging the deployment in feature receiver.
- Create new console application (.NET 4.5) project
- Add the following references to the project (not all are needed, but I didn't filter out unneeded references):
- Add WorkflowManagementClientExtensions class to the project:
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ using Microsoft.Activities; using Microsoft.Activities.Messaging; using Microsoft.Workflow.Client; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading; namespace Microsoft.Workflow.Samples.Common { public static class WorkflowManagementClientExtensions { public static void PublishActivity(this WorkflowManagementClient client, string name, string xamlFilePath) { client.Activities.Publish( new ActivityDescription(WorkflowUtils.Translate(xamlFilePath)) { Name = name }); } public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string xamlFilePath, SubscriptionFilter activationFilter = null) { PublishWorkflow(client, workflowName, xamlFilePath, null, null, activationFilter); } public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string xamlFilePath, Collection<ExternalVariable> externalVariables, SubscriptionFilter activationFilter = null) { PublishWorkflow(client, workflowName, xamlFilePath, externalVariables, null, activationFilter); } public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string xamlFilePath, IDictionary<string, string> configValues, SubscriptionFilter activationFilter = null) { PublishWorkflow(client, workflowName, xamlFilePath, null, configValues, activationFilter); } public static void PublishWorkflow(this WorkflowManagementClient client, string workflowName, string xamlFilePath, Collection<ExternalVariable> externalVariables, IDictionary<string, string> configValues, SubscriptionFilter activationFilter = null) { // publish the activity description related with the workflow client.Activities.Publish( new ActivityDescription(WorkflowUtils.Translate(xamlFilePath)) { Name = workflowName }); // now, publish the workflow description WorkflowDescription description = new WorkflowDescription { Name = workflowName, ActivityPath = workflowName, }; // add external variables if (externalVariables != null) { externalVariables .ToList() .ForEach(ev => description.ExternalVariables.Add(ev)); } // add config if (configValues != null) { description.Configuration = new WorkflowConfiguration(); configValues .ToList() .ForEach(c => description.Configuration.AppSettings.Add(c)); } // add activation filter if (activationFilter != null) { description.ActivationDescription = new SubscriptionActivationDescription { Filter = activationFilter }; } // publish! client.Workflows.Publish(description); } public static void CleanUp(this WorkflowManagementClient client) { client.CurrentScope.Delete(); } public static string WaitForWorkflowCompletion(this WorkflowManagementClient client, string workflowName, string instanceId, int pollingInterval = 0) { string currentStatus = string.Empty; string lastStatus = string.Empty; WorkflowInstanceInfo instanceInfo = client.Instances.Get(workflowName, instanceId); while (true) { instanceInfo = client.Instances.Get(workflowName, instanceId); currentStatus = instanceInfo.UserStatus; if (currentStatus != lastStatus && !string.IsNullOrWhiteSpace(currentStatus)) { Console.Write(" Current Status: "); WorkflowUtils.Print(currentStatus, ConsoleColor.Cyan); lastStatus = currentStatus; } if (instanceInfo.WorkflowStatus == WorkflowInstanceStatus.Started || instanceInfo.WorkflowStatus == WorkflowInstanceStatus.NotStarted) { Thread.Sleep(pollingInterval); continue; } if (instanceInfo.WorkflowStatus == WorkflowInstanceStatus.Completed) { Console.WriteLine("\nWorkflow instance completed"); } break; } return instanceInfo.UserStatus; } } } - Add WorkflowUtils class to the project. Notice that Translate method is loading assembly from Visual Studio PublicAssemblies folder:
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ using System; using System.Text; using System.Xaml; using System.Xml; using System.Xml.Linq; using Microsoft.Activities.Design.ExpressionTranslation; using Microsoft.Workflow.Client; using System.Reflection; namespace Microsoft.Workflow.Samples.Common { public class WorkflowUtils { public static WorkflowManagementClient CreateForSample(string rootScope, string scopeName) { var rootClient = new WorkflowManagementClient(new Uri(rootScope)); return rootClient.CurrentScope.PublishChildScope(scopeName, new ScopeDescription() { UserComments = string.Format("For {0} sample only", scopeName) }); } public static XElement Translate(string xamlFile) { string translatedWorkflowString = null; Assembly wfAssembly = Assembly.LoadFile(@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.SharePoint.DesignTime.Activities.dll"); XamlXmlReaderSettings settings = new XamlXmlReaderSettings(); settings.LocalAssembly = wfAssembly; using (XamlReader xamlReader = new XamlXmlReader(xamlFile, settings)) { TranslationResults result = ExpressionTranslator.Translate(xamlReader); if (result.Errors.Count == 0) { StringBuilder sb = new StringBuilder(); using (XmlWriter xmlWriter = XmlWriter.Create(sb, new XmlWriterSettings { Indent = true, OmitXmlDeclaration = true })) { using (XamlXmlWriter writer = new XamlXmlWriter(xmlWriter, result.Output.SchemaContext)) { XamlServices.Transform(result.Output, writer); } } translatedWorkflowString = sb.ToString(); } else { throw new InvalidOperationException("Translation errors"); } } return XElement.Parse(translatedWorkflowString); } public static void PrintDone() { Print("[Done]", ConsoleColor.Green); } public static void Print(string message, ConsoleColor color) { ConsoleColor currentColor = Console.ForegroundColor; Console.ForegroundColor = color; Console.WriteLine(message); Console.ForegroundColor = currentColor; } } } - Now you need to find out the GUID of the module which was used in deploying workflow (prerequisite). This GUID is located in the Module element, Url attribute in Elements.xml file in workflow folder. For example, in Elements.xml file:
<?xml version="1.0" encoding="utf-8" ?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Module Name="Workflow1" Url="wfsvc/86c7e42d4fe14b839d55fcbb6dde7b9c"> <File Url="Workflow.xaml" Type="GhostableInLibrary" Path="Workflow1\Workflow.xaml" DoGUIDFixUp="TRUE"> <Property Name="ContentType" Value="WorkflowServiceDefinition" /> <Property Name="isReusable" Value="true" /> <Property Name="RequiresInitiationForm" Value="False" /> <Property Name="RequiresAssociationForm" Value="False" /> <Property Name="WSPublishState" Value="3" /> <Property Name="WSDisplayName" Value="Workflow1" /> <Property Name="WSDescription" Value="My 'Workflow1' Workflow" /> <!-- If you change the name or Url of your custom initiation or association form, remember to update the corresponding property value (InitiationUrl or AssociationUrl) to match the new web relative url. --> <Property Name="RestrictToType" Value="List" /> <Property Name="RestrictToScope" Value="{$ListId:Shared Documents;}" /> </File> <File Url="WorkflowStartAssociation" Path="Workflow1\WorkflowStartAssociation" Type="GhostableInLibrary"> <Property Name="WSDisplayName" Value="Workflow1 - Workflow Start" /> <Property Name="ContentType" Value="WorkflowServiceSubscription" /> <Property Name="WSPublishState" Value="3" /> <Property Name="WSEventType" Value="WorkflowStart" /> <Property Name="WSEnabled" Value="true" /> <Property Name="WSGUID" Value="19cbf8a6-4af8-462c-b014-c8d7c0e327c1" /> <Property Name="WSEventSourceGUID" Value="{$ListId:Shared Documents;}" /> <Property Name="Microsoft.SharePoint.ActivationProperties.ListId" Value="{$ListId:Shared Documents;}" /> <Property Name="HistoryListId" Value="{$ListId:Lists/WorkflowHistoryList;}" /> <Property Name="TaskListId" Value="{$ListId:Lists/WorkflowTaskList;}" /> </File> </Module> <ListInstance FeatureId="{2c63df2b-ceab-42c6-aeff-b3968162d4b1}" TemplateType="4501" Title="wfsvc" Description="This list instance is used by SharePoint to keep track of workflows. Do not modify." Url="wfsvc" RootWebOnly="FALSE" /> </Elements>
this GUID is 86c7e42d4fe14b839d55fcbb6dde7b9c. Remember this GUID, you will need it in the following step. - Now you need to query workflow resource management database to find out the scope path of your workflow. If you left database name with default value during configuration of workflow farm, this query should get you the scope path (replace the GUID in query with GUID from the previous step):
SELECT [Path]
FROM [WFResourceManagementDB].[dbo].[Scopes] s
join [WFResourceManagementDB].[dbo].[Activities] a on s.ScopeId = a.ScopeId
where a.Name = 'WorkflowXaml_86c7e42d_4fe1_4b83_9d55_fcbb6dde7b9c' - Now it's time to change x:Class attribute in the workflow.xaml file. Last token in the attribute should contain GUID from step 5. For example: x:Class="In2.Ilas.Sp.Ecase.PukWf.WorkflowXaml_ed00d3bd_4796_41ba_b288_35ce2226f89a"
- Finally, console application should have the following code (replace the path from step 6 and workflow name from step 5):
using Microsoft.SharePoint; using Microsoft.SharePoint.Client; using Microsoft.SharePoint.Client.WorkflowServices; using Microsoft.Workflow.Client; using Microsoft.Workflow.Samples.Common; using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using System.Linq; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { WorkflowManagementClient client = new WorkflowManagementClient("http://zg-sp2013-02:12291/SharePoint/default/030e8465-c66c-4f9f-83af-e64d5a4a799b/61aa1fff-103e-49c8-bc56-395c27ca7f81"); client.Activities.Publish(new ActivityDescription(WorkflowUtils.Translate("Workflow.xaml")) { Name = "WorkflowXaml_ed00d3bd_4796_41ba_b288_35ce2226f89a" }); } } } - Copy Workflow.xaml file to console application's folder.
- Run the application.
Complete solution is available for download.
List of types in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.SharePoint.DesignTime.Activities.dll assembly:
namespace Microsoft.SharePoint.DesignTime.Activities
{
[ComVisible(false)]
public class AppOnlySequence : Activity, ISupportInitialize
[ComVisible(false)]
public class AtomicTaskItemUpdatedHelper : Activity, ISupportInitialize
[ComVisible(false)]
public class BuildSPListItemWebLink : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class BuildSPUri : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class Calc : Activity, ISupportInitialize
[ComVisible(false)]
public class CallHTTPWebService : Activity, ISupportInitialize
[ComVisible(false)]
public class CheckInItem : Activity, ISupportInitialize
[ComVisible(false)]
public class CheckOutItem : Activity, ISupportInitialize
[ComVisible(false)]
public class Comment : Activity, ISupportInitialize
[ComVisible(false)]
public class CompositeTask : Activity, ISupportInitialize
[ComVisible(false)]
public class CompositeTaskHelper : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class ConvertPropertiesForSPListItem : Activity, ISupportInitialize
[ComVisible(false)]
public class ConvertTimeZoneFromSPLocalToUtc : Activity<DateTime>, ISupportInitialize
[ComVisible(false)]
public class ConvertTimeZoneFromUtcToSPLocal : Activity<DateTime>, ISupportInitialize
[ComVisible(false)]
public class CopyItem : Activity, ISupportInitialize
[ComVisible(false)]
public class CreatedBy : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class CreatedInRange : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class CreateListItem : Activity<Guid>, ISupportInitialize
[ComVisible(false)]
public class DateInterval : Activity<double>, ISupportInitialize
[ComVisible(false)]
public class DefaultRetryPolicy : Activity, ISupportInitialize
[ComVisible(false)]
public class DelayFor : Activity, ISupportInitialize
[ComVisible(false)]
public class DelayUntil : Activity, ISupportInitialize
[ComVisible(false)]
public class DeleteListItem : Activity, ISupportInitialize
[ComVisible(false)]
public class Email : Activity, ISupportInitialize
[ComVisible(false)]
public class ExpandGroupToUsers : Activity<Collection<string>>, ISupportInitialize
[ComVisible(false)]
public class ExpandInitFormUsers : Activity<Collection<string>>, ISupportInitialize
[ComVisible(false)]
public class ExtractSubstringFromEnd : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class ExtractSubstringFromIndex : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class ExtractSubstringFromIndexLength : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class ExtractSubstringFromStart : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class GenerateEmailDynamicValue : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class GetCurrentItemGuid : Activity<Guid>, ISupportInitialize
[ComVisible(false)]
public class GetCurrentItemId : Activity<int>, ISupportInitialize
[ComVisible(false)]
public class GetCurrentListId : Activity<Guid>, ISupportInitialize
[ComVisible(false)]
public class GetHistoryListId : Activity<Guid>, ISupportInitialize
[ComVisible(false)]
public class GetItemIdInCache : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class GetTaskListId : Activity<Guid>, ISupportInitialize
[ComVisible(false)]
public class IsNull : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsSPListItemPropertyLookupToDocsField : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsValidUser : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class JoinChoicesFromSPFieldMultiChoice : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class JoinIdOrValueFromSPFieldLookupMulti : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class JoinSiteUserInfoListPropertyFromSPFieldUserMulti : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class JoinSPPrincipalPropertyFromInitFormParamUserMulti : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class LookupSPChoiceFieldIndex : Activity<int>, ISupportInitialize
[ComVisible(false)]
public class LookupSPField : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPFields : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPGroup : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPGroupMembers : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPList : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItem : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemBooleanProperty : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemDateTimeProperty : Activity<DateTime>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemDoubleProperty : Activity<double>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemDynamicValueProperty : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemGuid : Activity<Guid>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemId : Activity<int>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemInt32Property : Activity<int>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemProperty : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemPropertyNameInREST : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemSPFieldLookupMultiProperty : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemSPFieldLookupProperty : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListItemStringProperty : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class LookupSPListProperty : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPPrincipal : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPPrincipalId : Activity<int>, ISupportInitialize
[ComVisible(false)]
public class LookupSPPrincipalProperty : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class LookupSPTaskAssignedToDisplayName : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class LookupSPTaskListItemAssignedTo : Activity<Collection<string>>, ISupportInitialize
[ComVisible(false)]
public class LookupSPUser : Activity<DynamicValue>, ISupportInitialize
[ComVisible(false)]
public class LookupSPUserProperty : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class LookupWorkflowContextProperty : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class LoopNTimes : Activity, ISupportInitialize
[ComVisible(false)]
public class ModifiedBy : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class ModifiedInRange : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class RegisterForSharePointEvent : Activity, ISupportInitialize
[ComVisible(false)]
public class ReplaceEmailTokens : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class RetryForDurationPolicy : Activity, ISupportInitialize
[ComVisible(false)]
public class SetField : Activity, ISupportInitialize
[ComVisible(false)]
public class SetItemIdInCache : Activity, ISupportInitialize
[ComVisible(false)]
public class SetRelatedItem : Activity, ISupportInitialize
[ComVisible(false)]
public class SetTimeField : Activity<DateTime>, ISupportInitialize
[ComVisible(false)]
public class SetWorkflowStatus : Activity, ISupportInitialize
[ComVisible(false)]
public class SingleTask : Activity, ISupportInitialize
[ComVisible(false)]
public class TranslateDocument : Activity, ISupportInitialize
[ComVisible(false)]
public class UndoCheckOutItem : Activity, ISupportInitialize
[ComVisible(false)]
public class UpdateListItem : Activity, ISupportInitialize
[ComVisible(false)]
public class WaitForCustomEvent : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class WaitForFieldChange : Activity, ISupportInitialize
[ComVisible(false)]
public class WaitForItemEvent : Activity, ISupportInitialize
[ComVisible(false)]
public class WebUri : Activity<string>, ISupportInitialize
[ComVisible(false)]
public class WordsInTitle : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class WorkflowInterop : Activity<Guid>, ISupportInitialize
[ComVisible(false)]
public class WriteToHistory : Activity, ISupportInitialize
}
namespace Microsoft.SharePoint.DesignTime.Activities.Expressions
{
[ComVisible(false)]
public class ContainsStringIgnoreCase : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsEqualDate : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsEqualDateTime : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsEqualDynamicValue : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsEqualStringIgnoreCase : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsEqualUser : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsGreaterThanDateTime : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsGreaterThanOrEqualDateTime : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsLessThanDateTime : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class IsLessThanOrEqualDateTime : Activity<bool>, ISupportInitialize
[ComVisible(false)]
public class MatchesString : Activity<bool>, ISupportInitialize
}
namespace XamlStaticHelperNamespace
{
[GeneratedCode("XamlBuildTask", "4.0.0.0")]
internal class _XamlStaticHelper
}
Subscribe to:
Posts (Atom)


