I can debug but unable to execute my Selenium C# script - c#

If i debug my code its running line by line successfully. but when i run without breakpoints it shows the following error and my script failed.
"Failed PaymentGateway ProjectFunctions Test method Project_Automation.Functions.PaymentGateway threw exception: Selenium.SeleniumException: ERROR: There was an unexpected Alert! [Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0]."
Browser shows no error in UI. but Error console shows "Error: setting a property that has only a getter"
It shows at the end of a single for loop. i am unable to execute rest of the loops

Sounds like the property evaluation in one of the debugger windows has a side effect. This happens sometimes, try to turn this setting off in VS to eliminate this:
Tools -> Options -> Debugging -> Enabled property evaluation and other implicit function calls

Related

Connect-Azure AD in PowerShell Script called from C# fails in a specific way THE FIRST TIME, then works?

Here's the gist of my issue. I have a C# program that is calling several PowerShell cmdlets.
All the calls work, except when I get to "Connect-AzureAD -TenantId XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
But the way it "fails" is odd. It only lets me enter my Microsoft Account, but not the password. IF I RUN IT AGAIN, I can log in correctly and it works.
I thought I was hitting a timeout of some kind, but each call bellow results in a Null Reference Exception. You can see my comments of frustration.
// All of these are set to null...so what gives?
// all generate NRE's
//Debug.Print("MaxIdle Timeout is |{0}|", runspace.ConnectionInfo.MaxIdleTimeout.ToString());
//Debug.Print("Current Idle Timeout is |{0}|", runspace.ConnectionInfo.IdleTimeout.ToString());
//Debug.Print("Operation Timeout is |{0}|", runspace.ConnectionInfo.OperationTimeout.ToString());
Thoughts, ideas, comments?
I can post more of the code, if needed, but everything else works all the time.
Per a comment, I added a CR, but it appeared to do nothing (I will try a CR+LF, because I have no idea what's actually broken here, so there's no harm in trying).
So...after the PowerShell invoke call, I collect the results as follows:
foreach (PSObject outputObject in results)
and my results collection has these four errors in it:
{One or more errors occurred.: The browser based authentication dialog failed to complete. Reason: The server or proxy was not found.}
{One or more errors occurred.}
{ The browser based authentication dialog failed to complete. Reason: The server or proxy was not found.}
{One or more errors occurred.: The browser based authentication dialog failed to complete. Reason: The server or proxy was not found.}
It's telling me what I already know (that auth didn't work), but I'm still clueless as to what the actual issue is.
Adding some more detail
So...I've tried a few things. I added my Microsoft account to the connect. The result was even more odd -- a long delay, no password screen, and failure to log in.
Then I pivoted to setting up an application principal as detailed here: "Using a Service Principal to connect to a directory in PowerShell" https://learn.microsoft.com/en-us/powershell/azure/active-directory/signing-in-service-principal?view=azureadps-2.0
I got it all set up and verified in PowerShell that I can connect, then I placed the exact same (I copied and pasted it) Connect-AzureAD with the tenant, application ID, and certificate thumbprint that I used in PowerShell. It failed with these "new" errors -- still four somehow:
One or more errors occurred.
An error occurred while sending the request.
The remote name could not be resolved: 'login.microsoftonline.com'
One or more errors occurred.
Tomorrow, I'll fire up Wireshark. I'm getting the feeling that these errors are all misleading, although the fact that it works on the second try is just mind boggling.

the service instance will remain suspended until administratively resumed or terminated following error exception type initializer

I am getting the above error, exception type initializer.
Could please give what type of take an action to resolved this issue.
I got following error when am trying to drop a file in receive location and I did resumed in biztalk admin console it shows same error in event application logs.
You are getting this error due to your logging component, your logging component is trying to load itself via a static constructor most likely and failing there. It looks like it depends on Microsoft enterprise logging block, make sure you have all dependencies installed in GAC properly or check your logging component configuration to see why it's failing. It's not related to BizTalk issue.

Using RestSharp with Xamarin - Execute() throws exceptions when HTTP request fails

I'm using the RestSharp 105.2.3.0 in my project which runs on Xamarin.Android 6.0.1.10.
Everything was ok, but couple of days the call to Execute() method started throwing exceptions if HTTP requests did not succeed (I guess it's related to the update of the Xamarin platform?).
For example, I receive "System.Net.WebException: The remote server returned an error: (403) Forbidden." for the 403 response status code and "System.Net.Sockets.SocketException: No route to host" if the host is unreachable.
This is weird, since on this page - https://github.com/restsharp/RestSharp/wiki/Recommended-Usage - I see:
Note that exceptions from Execute are not thrown but are available in the ErrorException property.
Also, I found a SO question which is more or less for the same issue.
The proposed solution is to set the IgnoreResponseStatusCode property:
var client = new RestClient();
client.IgnoreResponseStatusCode = true;
But I don't see this property among those available in RestClient.
How could I fix this? Of course, I can wrap the Execute call in try..catch, but I would prefer to avoid it since the Execute is not supposed to throw exceptions in the first place.
I've figured it out.
The problem was related to the fact that in the Exception settings window (Debug -> Exceptions...) in Visual Studio all checkboxes were checked in the "Break when an exception is: Thrown" column.
So the exception was caught by the RestSharp code, but VS was still breaking the execution at the Execute call as it was configured to do so.
Screenshot: http://i.stack.imgur.com/a0Fc4.png

Intermittant JavaScript Error in DevExpress

I am getting an intermittent JavaScript error when using the DevExpress client API. This error can sometimes occur on one computer when all other computers are running the code perfectly fine.
The error is:
"Unhandled exception at line 70, column1 in http://localhost:4593/Home/Grid. JavaScript runtime error: 'MVCxClientGridView' is undefined."
The error occurs at the following line in the compiled code:
var dxo = new MVCxClientGridView('GridView');
I have not been able to successfully replicate the causes of the error - it sort of just goes away after awhile. What am I missing?

What causes the System.Web.HttpException with error code 0x80070057 on Page.Flush while debugging in VS2005?

Here is the complete error message:
An exception of type
'System.Web.HttpException' occurred in
System.Web.dll but was not handled in
user code
Additional information: The remote
host closed the connection. The error
code is 0x80070057.
and the offending code:
char[] buffer = oPage.HTML.HTML.ToCharArray();
Page.Response.Write(buffer, 0, buffer.Length);
Page.Response.Flush();
Page.Response.End();
The oPage.HTML.HTML is a string in a custom page object used by our app. The exception triggers on Page.Flush() and appears to be benign -- I just hit "continue" and everything goes along fine. This never appears at run time.
I have chased many, many Google hits down many rabbit holes and have found nothing. Visual Studio 2005, Vista Ultimate (IIS7).
I've been dealing with this same error for a while now, and my understanding is that when Flush is called, there must be a connection on the other end, otherwise, this error is thrown. It's easy to get into a "fire-and-forget" kind of model when writing web pages, but when the client disconnects (in this debugging case, you're the client), there's nowhere to flush to.
There are two solutions I've found to this:
Wrap Response.Flush and catch the exception.
Check Response.IsClientConnected before you call flush.
I'm not 100% sure about the second one...I'm still in the process of checking that one out.
Good luck!

Categories

Resources