I am currently setting up TFS release management using vNext template at work and running into an error when I re-deploying the application. If I remove the application from the server, it deploys without any error.
After a bit of investigation, I have narrowed it down to the xWebApplication that is causing it but I am unable to fix the issue.
I have simplified my deployment script to just copy the file and creating web application:
Configuration AddressServiceWebsite
{
Import-DscResource -Module xWebAdministration
Import-DscResource -ModuleName xReleaseManagement
Node $AllNodes.NodeName
{
File CopyDeploymentBits
{
Ensure = "Present"
Type = "Directory"
Recurse = $true
SourcePath = $applicationPath
DestinationPath = $Node.DeploymentPath
}
xWebApplication WebApplication {
Website = $Node.WebsiteName
Name = $Node.ApplicationName
WebAppPool = $Node.ApplicationPool
PhysicalPath = $Node.DeploymentPath
Ensure = "Present"
}
}
}
AddressServiceWebsite -ConfigurationData $ConfigData -Verbose -Force
and am getting the following error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException: Copying recursively from \\whds001\tfs\Builds\Direct\SOA\AddressService\PR000081 to C:\Windows\DtlDownloads\AddressService succeeded.
System.AggregateException: Failed to apply configuration in the DSC script to the computer. Consult the Logs below for details of the error.
Destination element already exists, please use "force" parameter to override.
CategoryInfo :InvalidArgument: (:) [], CimException
FullyQualifiedErrorId :Destination element already exists, please use "force" parameter to override.,Microsoft.IIs.PowerShell.Provider.NewWebApplicationCommand
The PowerShell provider MSFT_xWebApplication threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
CategoryInfo :InvalidOperation: (:) [], CimException
FullyQualifiedErrorId :NonTerminatingErrorFromProvider
The SendConfigurationApply function did not succeed.
CategoryInfo :NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
FullyQualifiedErrorId :MI RESULT 1
---> Microsoft.Management.Infrastructure.CimException: Destination element already exists, please use "force" parameter to override.
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable)
at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Utilities.RetryExecutor.Execute(Action action)
at Microsoft.VisualStudio.Services.DevTestLabs.RemoteDeployer.Deployment.DeploymentService.RunPowerShellScripts(DeploymentMachineSpecification deploymentMachine, ScriptSpecification scriptSpecification, ScriptSpecification initializationScriptSpecification, String applicationPath, IPowerShell powerShellSession)
---> (Inner Exception #0) Microsoft.Management.Infrastructure.CimException: Destination element already exists, please use "force" parameter to override.<---
---> (Inner Exception #1) Microsoft.Management.Infrastructure.CimException: The PowerShell provider MSFT_xWebApplication threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.<---
---> (Inner Exception #2) Microsoft.Management.Infrastructure.CimException: The SendConfigurationApply function did not succeed.
at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.ProcessNativeCallback(OperationCallbackProcessingContext callbackProcessingContext, T currentItem, Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle errorDetailsHandle)<---
Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
An LCM method call arrived from computer WHWA041 with user sid S-1-5-21-12480674-1100442233-928725530-45419.
[WHWA041]: LCM: [ Start Set ]
[WHWA041]: LCM: [ Start Resource ] [[File]CopyDeploymentBits]
[WHWA041]: LCM: [ Start Test ] [[File]CopyDeploymentBits]
[WHWA041]: [[File]CopyDeploymentBits] Building file list from cache.
[WHWA041]: LCM: [ End Test ] [[File]CopyDeploymentBits] in 0.0460 seconds.
[WHWA041]: LCM: [ Start Set ] [[File]CopyDeploymentBits]
[WHWA041]: [[File]CopyDeploymentBits] Building file list from cache.
[WHWA041]: [[File]CopyDeploymentBits] The destination object was found and no action is required.
[WHWA041]: LCM: [ End Set ] [[File]CopyDeploymentBits] in 0.0470 seconds.
[WHWA041]: LCM: [ End Resource ] [[File]CopyDeploymentBits]
[WHWA041]: LCM: [ Start Resource ] [[xWebApplication]WebApplication]
[WHWA041]: LCM: [ Start Test ] [[xWebApplication]WebApplication]
[WHWA041]: [[xWebApplication]WebApplication] Checking whether WebAdministration is there in the machine or not.
[WHWA041]: LCM: [ End Test ] [[xWebApplication]WebApplication] in 0.9980 seconds.
[WHWA041]: LCM: [ Start Set ] [[xWebApplication]WebApplication]
[WHWA041]: [[xWebApplication]WebApplication] Checking whether WebAdministration is there in the machine or not.
[WHWA041]: LCM: [ End Set ] [[xWebApplication]WebApplication] in 0.9990 seconds.
[WHWA041]: LCM: [ End Set ]
Operation 'Invoke CimMethod' complete.
Time taken for configuration job to complete is 2.292 seconds
at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.ReadDeploymentResponse(DeploymentResponse response)
at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.<RunPowerShellScript>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.<RunScript>d__0.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.TeamFoundation.Release.MonitorServices.Dsc.OnPrem.OnPremDeploymentActions.InvokePlatform(String activityId, MachineSpecification machineSpecification, StorageSpecification storageSpecification, String scriptPath, String configurationPath, Dictionary`2 configurationVariables)
at Microsoft.TeamFoundation.Release.MonitorServices.Dsc.OnPrem.OnPremDeploymentActions.RunScript(DscComponent dscComponentParameters, String serverName, String userName, String password, String componentName, String scriptPath, String configurationPath, String useCredSecuritySupportProvider, String useHttps, String skipCACheck)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.Dsc.DscComponentInstaller.InvokeMethodByReflection(String methodArguments)
You will not be able to deploy over the top with xWebApplication as It tries to create the same web application. You should delete the web application, even if you leave the files, before you try to deploy again.
Related
My PC environment is Windows 10 Enterprise Evaluation, Build 17763.rs5_release.180914-1434
When I entered this command $consumer = ([wmiclass]"\.\root\subscription:CommandLineEventConsumer").CreateInstance() in Powershell (Run as Administrator), I got an exception like below.
Cannot convert value "\\.\root\subscription:CommandLineEventConsumer" to type "System.Management.ManagementClass". Error: "Not found
"
At line:1 char:1
+ $consumer = ([wmiclass]"\\.\root\subscription:CommandLineEventConsume ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastToWMIClass
I tried to digger more deeper information, then I got some messages like below
System.Management.Automation.RuntimeException: Cannot convert value "\\.\root\subscription:CommandLineEventConsumer" to type "System.Management.ManagementClass". Error: "Not found " ---> System.Management.Automation.PSInvalidCastException: Cannot convert value "\\.\root\subscription:CommandLineEventConsumer" to type "System.Management.ManagementClass". Error: "Not found " ---> System.Management.ManagementException: Not found
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementObject.Initialize(Boolean getObject)
at System.Management.ManagementBaseObject.get_wbemObject()
at System.Management.PropertyData.RefreshPropertyInfo()
at System.Management.PropertyDataCollection.get_Item(String propertyName)
at System.Management.Automation.LanguagePrimitives.ConvertToWMIClass(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
--- End of inner exception stack trace ---
at System.Management.Automation.LanguagePrimitives.ConvertToWMIClass(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Actually, I could register __EventFilter, __EventConsumer and __FilterToConsumerBinding at first.
However, after trying some commands related to register and unregister WMI (Sorry I didn't remember what commands I tried...), I couldn't register __EventConsumer anymore, even though I tried to reboot PC and unregister all of them, I still get the exception like above.
you can try something like this instead to create a new instance in the CommandLineEventConsumer Class. The same will go for Filters and Consumer Binding.
$Properties = #{
"Name"="Test"
"CommandLineTemplate"="C:\Windows\Notepad.exe"
}
New-CimInstance -Namespace 'ROOT\subscription' -ClassName 'CommandLineEventConsumer' -Arguments $Properties
I have a recipe that iterates a hash containing SQL scripts in an each method and -- in case the script changed from the previous run -- the cookbook_file resource notifies the execute resource to run.
The issue is that it seems it always runs the execute using the last element of the hash.
Following the attributes file
default['sql_scripts_dir'] = 'C:\\DBScripts'
default['script_runner']['scripts'] = [
{ 'name' => 'test', 'hostname' => 'local' },
{ 'name' => 'test2', 'hostname' => 'local' },
{ 'name' => 'test3', 'hostname' => 'local' },
{ 'name' => 'test4', 'hostname' => 'local' },
]
And the recipe
directory node['sql_scripts_dir'] do
recursive true
end
node['script_runner']['scripts'].each do |script|
cookbook_file "#{node['sql_scripts_dir']}\\#{script['name']}.sql" do
source "#{script['name']}.sql"
action :create
notifies :run, 'execute[Create_scripts]', :immediately
end
execute 'Create_scripts' do
command "sqlcmd -S \"#{script['hostname']}\" -i \"#{node['sql_scripts_dir']}\\#{script['name']}.sql\""
action :nothing
end
end
And it produces the following output:
Recipe: test_runner::default
* directory[C:\DBScripts] action create
- create new directory C:\DBScripts
* cookbook_file[C:\DBScripts\test.sql] action create
- create new file C:\DBScripts\test.sql
- update content in file C:\DBScripts\test.sql from none to 8c40f1
--- C:\DBScripts\test.sql 2020-07-30 17:30:30.959220400 +0000
+++ C:\DBScripts/chef-test20200730-1500-11bz3an.sql 2020-07-30 17:30:30.959220400 +0000
## -1 +1,2 ##
+select ##version
* execute[Create_scripts] action run
================================================================================
Error executing action `run` on resource 'execute[Create_scripts]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of sqlcmd -S "local" -i "C:\DBScripts\test4.sql" ----
STDOUT:
STDERR: Sqlcmd: 'C:\DBScripts\test4.sql': Invalid filename.
---- End output of sqlcmd -S "local" -i "C:\DBScripts\test4.sql" ----
Ran sqlcmd -S "local" -i "C:\DBScripts\test4.sql" returned 1
The expected behavior is that the recipe runs sequentially the 4 scripts in the example instead of running just the last one. What am I missing for getting it done?
You are creating 4 nearly identical resources all named execute[Create_scripts] and when the notification fires from the first cookbook_file resource being updated it finds the last one of them to be notified and runs against test4 (no matter which cookbook_file resource updates).
The fix is to use string interpolation to change the name of the execute resources to be unique and to notify based on that unique name:
directory node['sql_scripts_dir'] do
recursive true
end
node['script_runner']['scripts'].each do |script|
cookbook_file "#{node['sql_scripts_dir']}\\#{script['name']}.sql" do
source "#{script['name']}.sql"
action :create
notifies :run, "execute[create #{script['name']} scripts]", :immediately
end
execute "create #{script['name']} scripts" do
command "sqlcmd -S \"#{script['hostname']}\" -i \"#{node['sql_scripts_dir']}\\#{script['name']}.sql\""
action :nothing
end
end
Note that this is a manifestation of the same issues behind the old CHEF-3694 warning message where what would happen is that all the four execute resources would be merged into one resource via "resource cloning" with the properties of the subsequent resource being "last-writer-wins".
In Chef 13 this was changed to remove resource cloning and the warning, and in most circumstances having two resources named the same thing in the resource collection is totally harmless -- until you try to notify one of those resources. The resource notification system should really warn in this situation rather than silently picking the last resource that matches (but between notifications, subscribes, lazy resolution and now unified_mode that code is very complicated and you only want it to be firing under exactly the right conditions).
I want to get the current restart policy of an AppServer (RUNNING, STOPPED or PREVIOUS) using Jython.
servers = AdminTask.listServers('[-serverType APPLICATION_SERVER]').splitlines()
for server in servers:
print server
print AdminConfig.showAttribute(server, "monitoringPolicy")
break
This gave me an exception that the attribute is invalid:
An exception occurred when executing the file "test.py". Information
about the exception: com.ibm.ws.scripting.ScriptingException:
WASX7080E: Invalid attributes for type "Server" -- "monitoringPolicy".
But I could get the attribute using print AdminConfig.showall(server):
...
[monitoringPolicy [[autoRestart true]
[maximumStartupAttempts 3]
[nodeRestartState STOPPED]
[pingInterval 60]
[pingTimeout 300]]]
...
For me it looks like monitoringPolicy is the key of an array, so that it should be possible to get the restart state with
policy = AdminConfig.showAttribute(server, "monitoringPolicy")
restartState = policy["restartState"] # Should be "STOPPED"
Where is the problem?
Edit
After taking a deeper look in the list output, I saw that I missed a top level property processDefinitions, which is the parent of monitoringPolicy.
pd = AdminConfig.showAttribute(server, "processDefinitions")
print pd
This prints:
[(cells/CnxCell/nodes/CnxNode01/servers/UtilCluster_server1|server.xml#JavaProcessDef_1578492353152)]
But I'm not able to get any of the child propertys from this object:
# TypeError: sequence subscript must be integer or slice
print pd["monitoringPolicy"]
# AttributeError: 'string' object has no attribute 'monitoringPolicy'
print pd.monitoringPolicy
MonitoringPolicy has his own type. This prints the server and the state, so 'RUNNING', 'STOPPED'
servers = AdminTask.listServers('[-serverType APPLICATION_SERVER]').splitlines()
for server in servers:
print(server)
mpol = AdminConfig.list("MonitoringPolicy", server)
print(AdminConfig.showAttribute(mpol, 'nodeRestartState'))
I have subscribers to a topic in Azure Service Bus. I am frequently seeing intermittent errors being returned as follows:
MassTransit.Azure.ServiceBus.Core.Transport.ReceiveTransport Error: 0 : ReceiveTransport Faulted: sb://###, System.AggregateException: One or more errors occurred. (One or more errors occurred. (Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime)) ---> System.AggregateException: One or more errors occurred. (Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime) ---> System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime
I cannot see how/where to set the dueTime in order to prevent this happening. Subscribers are processing messages most of the time.
Is there a way to set dueTime with MassTransit?
Publisher:
await _busControl.Publish(new ConfigurationReloaded(),
context => context.TimeToLive = new TimeSpan(0, 0, 10, 0), cancellationToken);
Publish Error:
System.AggregateException: One or more errors occurred. (Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime) ---> System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime
at Microsoft.Azure.ServiceBus.Core.MessageSender.OnSendAsync(IList`1 messageList)
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync(IList`1 messageList)
at MassTransit.Azure.ServiceBus.Core.Transport.ServiceBusSendTransport.SendClientPipe`1.Send(SendEndpointContext clientContext)
at MassTransit.Azure.ServiceBus.Core.Transport.ServiceBusSendTransport.SendClientPipe`1.Send(SendEndpointContext clientContext)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at MassTransit.Transports.PublishEndpoint.Publish[T](CancellationToken cancellationToken, T message, PublishEndpointPipeAdapter`1 adapter)
at MassTransit.Transports.PublishEndpoint.Publish[T](CancellationToken cancellationToken, T message, PublishEndpointPipeAdapter`1 adapter)
at Services.ConfigurationUpdatedHostedService.StartAsync(CancellationToken cancellationToken) in /src/ConfigurationService/Services/ConfigurationUpdatedHostedService.cs:line 32
at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.ExecuteAsync(Func`2 callback)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.ExecuteAsync(Func`2 callback)
at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.StartAsync(CancellationToken token)
---> (Inner Exception #0) System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime
Receiver:
serviceBusHost.ConnectSubscriptionEndpoint<ConfigurationReloaded>($"{_serviceBusOptions.SubscriberName}_{_myUniqueSubscriberName}", x =>
{
x.AutoDeleteOnIdle = _serviceBusOptions.TimeToRemoveOnIdle;
x.Handler<ConfigurationReloaded>(context =>
{
this.Load();
return Task.CompletedTask;
});
});
Full Stack Trace:
MassTransit.Azure.ServiceBus.Core.Transport.ReceiveTransport Error: 0 : ReceiveTransport Faulted: sb://###, System.AggregateException: One or more errors occurred. (One or more errors occurred. (Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime)) ---> System.AggregateException: One or more errors occurred. (Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime) ---> System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.OnReceiveAsync(Int32 maxMessageCount, TimeSpan serverWaitTime)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.ReceiveAsync(Int32 maxMessageCount, TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.ReceiveAsync(TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.MessageReceivePump.MessagePumpTaskAsync()
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at MassTransit.Azure.ServiceBus.Core.Pipeline.MessageReceiverFilter.GreenPipes.IFilter<MassTransit.Azure.ServiceBus.Core.ClientContext>.Send(ClientContext context, IPipe`1 next)
at MassTransit.Azure.ServiceBus.Core.Pipeline.MessageReceiverFilter.GreenPipes.IFilter<MassTransit.Azure.ServiceBus.Core.ClientContext>.Send(ClientContext context, IPipe`1 next)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at GreenPipes.Agents.PipeContextSupervisor`1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe`1 pipe, CancellationToken cancellationToken)
at MassTransit.Azure.ServiceBus.Core.Transport.ReceiveTransport.<Receiver>b__13_0()
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. (Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime) ---> System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.OnReceiveAsync(Int32 maxMessageCount, TimeSpan serverWaitTime)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.ReceiveAsync(Int32 maxMessageCount, TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.ReceiveAsync(TimeSpan operationTimeout)
at Microsoft.Azure.ServiceBus.MessageReceivePump.MessagePumpTaskAsync()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: dueTime
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.OnReceiveAsync(Int32 maxMessageCount, TimeSpan serverWaitTime)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func`1 operation, TimeSpan operationTimeout)
Service Collection Extension to add Mass Transit:
public static IServiceCollection AddMassTransit(
this IServiceCollection collection, string serviceBusHost, string serviceBusKeyName, string serviceBusSharedAccessKey)
{
collection.AddSingleton(Bus.Factory.CreateUsingAzureServiceBus(cfg =>
{
var host = cfg.Host(
serviceBusHost,
h =>
{
h.SharedAccessSignature(s =>
{
s.KeyName = serviceBusKeyName;
s.SharedAccessKey = serviceBusSharedAccessKey;
});
});
collection.AddSingleton(host);
}
));
collection.AddSingleton<IHostedService, BusService>();
return collection;
}
I've been suffering from this issue too. After debugging I think I found the issue. There is a default value in the .net core service bus library that is too low.
In the ShareAccessSignature config method setting TokenTimeToLive to a reasonable value seemed to solve.
sbcfg.SharedAccessSignature(sas =>
{
sas.TokenTimeToLive = TimeSpan.FromMinutes(20);
sas.KeyName = Configuration.GetValue<string>("ServiceBus:KeyName");
sas.SharedAccessKey = Configuration.GetValue<string>("ServiceBus:AccessKey");
});
For info these are the related (open) issues in github related to this default behaviour.
https://github.com/Azure/azure-service-bus-dotnet/issues/672
https://github.com/Azure/azure-sdk-for-net/issues/6312
I am trying to run recorded test cases and its giving me this error :(
I am not able to understand this.
Please help.
Test Name: CodedUITestMethod1
Test FullName: CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1
Test Source: d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\CodedUITest1.cs : line 30
Test Outcome: Failed
Test Duration: 0:00:23.5295373
Result Message:
Test method CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'UIA'
FrameworkId: 'Wpf'
ControlType: 'Window'
Name: 'C5K Setup'
ClassName: 'HwndWrapper'
---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
Result StackTrace:
at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IRPFPlayback.FindAllScreenElements(IScreenElement pScreenElementStart, String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth, Object[]& foundDescendants)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindTopLevelWindowHelper(String queryId)
at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindFromPartialQueryId(String queryId, Boolean resetSkipStep)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl..ctor(String queryId)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException(COMException ex, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, IPlaybackContext context)
at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(SystemException exception, String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl..ctor(String queryId)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.SearchTopLevelWindow(ISearchArgument topLevelSearchArg, String topLevelElementQueryId)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTitleUpdatedTopLevelWindow(ISearchArgument topLevelSearchArg, String queryId, IList`1 windowTitles)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTopLevelElement(Boolean useCache, Boolean useCacheOnly, ISearchArgument searchArg, IList`1 windowTitles, Int32& timeLeft)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(ISearchArgument searchArg)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__3a()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find()
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyPrivate(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<>c__DisplayClass3e.<GetProperty>b__3d()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(String propertyName)
at Microsoft.VisualStudio.TestTools.UITesting.ALUtility.GetTechElementFromUITestControl(UITestControl uiTestControl)
at Microsoft.VisualStudio.TestTools.UITesting.ActionExecutorManager.GetActionExecutor(UITestControl uiControl)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.ClickImplementation(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.<>c__DisplayClass6.<Click>b__5()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, MouseButtons button, ModifierKeys modifierKeys, Point relativeCoordinate)
at Microsoft.VisualStudio.TestTools.UITesting.Mouse.Click(UITestControl control, Point relativeCoordinate)
at CanopusCodedUITestProject.UIMap.CreateConfiguration() in d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\UIMap.Designer.cs:line 280
at CanopusCodedUITestProject.CodedUITest1.CodedUITestMethod1() in d:\CanopusDev\Main\Source\Solutions\CanopusCodedUITestProject\CodedUITest1.cs:line 32
Looks like the properties of the UI Component on which you recorded has changed and so it is not able to perform your recorded actions. Verify if the search properties of the component is still the same as when you recorded.
Please look at the line shown below in your stack trace:
Microsoft.VisualStudio.TestTools.UITesting.Mouse.
Click(UITestControl control, Point relativeCoordinate)
This means that the CodedUI is trying to click on a control using a specific point on the screen.
For some reason it is unable to find the control it wants to click. Maybe no button exists on this specific point.
Most probably, the screen resolution of your current display device is different from the screen resolution of the display device you used to record these tests.