UIAComWrapper API related Methods throwing Element Not Available Exception on Windows 10 - automation

I am using UIAComWrapper.dll related methods in our code FindFirst(),FindALL() and GetParent().
Randomly each Method is throwing ElementNotAvailableException.
Exceptions as follows:
System.Windows.Automation.ElementNotAvailableException was caught
HResult=-2147220991
Message=Element not available
Source=UiaComWrapper
InnerException: System.Runtime.InteropServices.COMException
ErrorCode=-2146233083
HResult=-2146233083
Message=Operation timed out.
(Exception from HRESULT: 0x80131505)
Source=Interop.UIAutomationClient
StackTrace:
at UIAutomationClient.IUIAutomationTreeWalker.GetParentElementBuildCache(IUIAutomationElement element, IUIAutomationCacheRequest cacheRequest)
at System.Windows.Automation.TreeWalker.GetParent(AutomationElement element, CacheRequest request)"
Regards,
Nagasree.

Related

ASP.NET Core - Exception inside HealtCheck message

I'm wonder what is the purpose of exception parameter that we can pass to
HealthCheckResult.Unhealthy("Message", exception);
When this result is used in health-check endpoint only message and status are used and no info from exception?
An Exception representing the exception that was thrown when checking for status. Optional.
https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.diagnostics.healthchecks.healthcheckresult.unhealthy?view=dotnet-plat-ext-3.0
Here's a good explanation on how to use it: https://blog.elmah.io/asp-net-core-2-2-health-checks-explained/

How to get stack trace from System.AccessViolationException?

I have a crash dump (minidump) for an applicaiton which includes managed and unmanaged code. The application crashed with exception System.Reflection.TargetInvocationException during execution of Delegate.DynamicInvoke. The inner exception is System.AccessViolationException but it doesn't include stack trace information (see below).
Is it possible to get this stack trace somehow?
Windbg output for !analyze -v (I've shortened the stack trace to make it more clear):
EXCEPTION_OBJECT: !pe 6c09b28
Exception object: 0000000006c09b28
Exception type: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
InnerException: System.AccessViolationException, Use !PrintException 0000000006c09988 to see more.
StackTrace (generated):
SP IP Function
00000000004FB540 0000000000000000 mscorlib_ni!System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)+0x1
00000000004FB540 000007FEF761D28C mscorlib_ni!System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])+0x4c
00000000004FB5B0 000007FEF754FD3A mscorlib_ni!System.Delegate.DynamicInvokeImpl(System.Object[])+0x6a
00000000004FB610 000007FE99A15010 CCTV_Framework_Utility!CCTV.Framework.Utility.EventsHelper.SafeInvoke(System.Delegate, System.Object[])+0x60
StackTraceString:
HResult: 80131604
EXCEPTION_OBJECT: !pe 6c09988
Exception object: 0000000006c09988
Exception type: System.AccessViolationException
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
InnerException: none
StackTrace (generated): none
StackTraceString: none
HResult: 80004003

Get more info from sqlclient error message

I connect my windows mobile app directly to ms-sql server using the sqlclient dll from microsoft.
Some times I get this error when trying to get some data from the server:
System.Data.SqlClient.SqlException: SqlException
at System.Data.SqlClient.SqlConnection.OnError()
at System.Data.SqlClient.SqlInternalConnection.OnError()
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run()
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at System.Data.SqlClient.SqlCommand.ExecuteReader()
Every time I have a error like this I need to try a few other things, some times the connection string is no good, or the network is not configured right or any other random problem.
Is there a way I could get a bit more info from the program so I shouldn't have to waste a few hours figuring out what might went rung?
That's basically just the stack trace. You should be able to get the Message property of the SqlException which contains the details. In some cases you will have to look at the InnerException to get to the interesting details.
Ok I found the answer... I changed: Catch ex As Exception To: Catch ex As SqlException
Now I get the specific error nicely displayed in the message.

User Profile Service Application Error: "Unable to process Put message "

When I try to save changes to an existing synchronization connection in the User Profile Service Application in SharePoint 2010 I get the following error:
"Unable to process Put message".
In the event log I get three error messages:
1. Forefront Identity Manager Event ID 3
Microsoft.ResourceManagement.Service: Microsoft.ResourceManagement.ResourceManagementException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
at MIISRCW.IMMSManagementAgent.ModifyMAData(String pszMADataXML, String& ppszUpdatedXML)
at Microsoft.ResourceManagement.SyncConfig.SetMaData(Guid maGuid, String maData)
at Microsoft.ResourceManagement.ActionProcessor.SyncConfigActionProcessor.Update(Guid objectId, CultureInfo locale, IList1 updateParameters, Guid cause)
--- End of inner exception stack trace ---
at Microsoft.ResourceManagement.ActionProcessor.SyncConfigActionProcessor.Update(Guid objectId, CultureInfo locale, IList`1 updateParameters, Guid cause)
at Microsoft.ResourceManagement.ActionProcessor.SyncConfigActionProcessor.ProcessInputRequest(RequestType request)
at Microsoft.ResourceManagement.ActionProcessor.ActionDispatcher.ProcessInputRequest(RequestType request)
at Microsoft.ResourceManagement.WebServices.RequestDispatcher.ExecuteAction(RequestType request)
at Microsoft.ResourceManagement.WebServices.RequestDispatcher.ExecuteAction[ResponseBodyType](RequestType request)
at Microsoft.ResourceManagement.WebServices.RequestDispatcher.DispatchRequest[ResponseBodyType](RequestType request, Guid requestIdentifier, Object redispatchSingleInstanceKey)
at Microsoft.ResourceManagement.WebServices.RequestDispatcher.DispatchRequest[ResponseBodyType](RequestType request)
at Microsoft.ResourceManagement.WebServices.RequestDispatcher.DispatchRequest(RequestType request)
at Microsoft.ResourceManagement.WebServices.ResourceManagementService.Put(Message request)
2. Forefront Identity Manager Event ID 3
Microsoft.ResourceManagement.ResourceManagementException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
at MIISRCW.IMMSManagementAgent.ModifyMAData(String pszMADataXML, String& ppszUpdatedXML)
at Microsoft.ResourceManagement.SyncConfig.SetMaData(Guid maGuid, String maData)
at Microsoft.ResourceManagement.ActionProcessor.SyncConfigActionProcessor.Update(Guid objectId, CultureInfo locale, IList`1 updateParameters, Guid cause)
--- End of inner exception stack trace ---
3. FIMSynchronization Service Event ID 6309
The server encountered an unexpected error while performing an operation for a management agent.
"BAIL: MMS(6196): mastate.cpp(10154): 0x80040154 (Class not registered)
BAIL: MMS(6196): mastate.cpp(6332): 0x80040154 (Class not registered)
BAIL: MMS(6196): ma.cpp(1334): 0x80040154 (Class not registered)
BAIL: MMS(6196): ma.cpp(1592): 0x80040154 (Class not registered)
Forefront Identity Manager 4.0.2450.11"
I had this instance of the User Profile Service Application set up and working for several months before this problem popped up. My guess is it's related to a Cumulative Update or something like that. Has anyone seen this problem or have any idea how to fix it? I've already tried everything in this link: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/8ee7a934-3336-4041-8993-7d55380b244f/.
Thanks in advance,
John P.
I am not sure why this happens but if you restart these Windows services it should start working
Forefront Identity Manager Service
Forefront Identity Manager Synchronization Service

WCF throwing CommunicationException when FaultException is thrown

Solution:
A bit of tracing showed the CommunicationException was being thrown because there was an issue with my exception T not serializing correctly; because, two layers deep, I had an anonymously typed object, which was unserializable. Removing it and bubbling up the changes appeared to fix it. There was somethinge else small I did before that, but I can't remember for the life of me what it was, only that it wasn't done in the config.
I was getting messages from my traces such as:
Type 'RebuiltWCFService.Requests.HelloWorldRequest' with data contract name 'HelloWorldRequest:http://schemas.datacontract.org/2004/07/RebuiltWCFService.Requests' is not expected.
Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
Original post
I've encountered a seemingly strange issue today that I just cant't find an answer to!
The problem: my service is throwing a CommunicationException when I throw a FaultException! It does not do this if I don't throw an exception.
In my service, I'm properly defining the fault contracts:
[OperationContract]
[FaultContract(typeof(Faults.HelloWorldFault))]
Responses.HelloWorldResponse HelloWorld(Requests.HelloWorldRequest parameter);
Then under error conditions I'm throwing an exception of the correct type:
if (_errors.Count() > 0)
{
Faults.HelloWorldFault fault = new Faults.HelloWorldFault(_errors);
throw new FaultException<Faults.HelloWorldFault>(fault, new FaultReason("There are one or more errors in the request. Check the 'Errors' property for more detaisl"));
}
And then I'm catching it on the client end:
try
{
response = client.HelloWorld(new BasicService.HelloWorldRequest() { Number = 49 });
client.Close();
Console.WriteLine(String.Format("Response message: {0}, Response number: {1}", response.Message, response.Number));
}
catch (FaultException<BasicService.HelloWorldFault> ex)
{
...
}
That all seems OK to me, and like it should work. However, as soon as I go to test my error clauses (by providing bad data, such as a missing field), the whole thing dies on me. When I throw my FaultException, the service instead throws a CommunicationException with the message
An error occurred while receiving the HTTP response to http://localhost:8732/Design_Time_Addresses/RebuiltWCFService/Service1/.
This could be due to the service endpoint binding not using the HTTP protocol.
This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down).
See server logs for more details.
Can anybody offer some insight on this one? I am using the basicHttp binding, and I've also tried it with wsHttp. I will post my config file upon request.
A FaultException is a child of CommunicationException. So there is nothing wrong in what's happening in your code.
If you are uncertain about what the exception is while handling, it is usually reported as CommunicationException. If you want to handle your specific exception in your own way, use the following structure.
try
{ ... }
catch (FaultException<MyDemoException> me)
{ ... }
catch (FaultException fe)
{ ... }
catch (CommunicationException ce)
{ ... }
catch (Exception ex)
{ ... }
In the above structure, Exception is parent of CommunicationException. CommunicationException is the parent of FaultException and so on.
System.Object
System.Exception
System.SystemException
System.ServiceModel.CommunicationException
System.ServiceModel.FaultException
System.ServiceModel.FaultException<TDetail>
System.ServiceModel.Web.WebFaultException<T>
Thanks guys, you helped me to understand the issue in a better way. My observation: I kept a List MyData - to hold any generic/dynamic collection, that was unable to serialize, so resulting to close the connection, so the communication exception.
When I removed the List from Fault Contract, and throw Fault style, it was clearly giving Fault contract exception, instead of communication exception.
Hope it helps,
HydTechie.
I ran into this problem because I had one or more breakpoints in the wrong place. I removed all breakpoints with Debug..Delete all Breakpoints (Ctrl-Alt-F9), and all of the CommunicationException exceptions disappeared and were replaced with the correct messages coming back.
Yes, the timeout is 60 seconds, so this never should have occurred, so it was probably some weird artifact of Visual Studio 2012.