Showing posts with label Error. Show all posts
Showing posts with label Error. Show all posts

Error : Could not find a part of the path 'bin\roslyn\csc.exe'

Error : Could not find a part of the path 'bin\roslyn\csc.exe'



Error

[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\
Microsoft\VisualStudio\v16.0\Web\Microsoft.Web.Publishing.targets(2601,5):
Error : Copying file bin\roslyn\csc.exe to
obj\Release\Package\PackageTmp\bin\roslyn\csc.exe failed.
Could not find a part of the path 'bin\roslyn\csc.exe'.

Solution

run this in the Package Manager Console: Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r

Hope this will help you and save your time.

Enjoy !!!

:)

Test discovery or execution might not work for this project

Error: Test discovery or execution might not work for this project.'


Issue

Message=Test discovery or execution might not work for this project. It's recommended to reference NuGet test adapters in each test project in the solution.

 

Solution

If you are using MS Test, try installing

MSTest.TestAdapter via nuget

if you are using nunit, install

NUnit3TestAdapter latest versions via nuget.

  
After installing please restart the visual studio and then you can see the tests running.

Hope this will help you and save your time.

Enjoy !!!

:)

Error: Inheritance security rules violated by type: 'System.Net.Http.WebRequestHandler'

Error: Inheritance security rules violated by type: 'System.Net.Http.WebRequestHandler'


Issue

Message=Inheritance security rules violated by type: 'System.Net.Http.WebRequestHandler'. Derived types must either match the security accessibility of the base type or be less accessible.

Source=Microsoft.Rest.ClientRuntime

Solution


I have updated nuget package "System.Net.Http" to version 4.3.1 with NuGet and that solved the issue.
  
Hope this will help you and save your time.

Enjoy !!!

:)

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.


I got below error while calling web api on https and found the solution.

Error


System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

  

Solution

I solved this error by adding this line before calling the web method:

System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return true; };


Hope this will help you and save your time.

Enjoy !!!

:)

IQueryable - Value cannot be null. Parameter name: property

Value cannot be null.

Parameter name: property


I got below error while I called orderby with IQueryable,

Error


Value cannot be null.
Parameter name: property

StackTrace:
.... OrderBy[T](IQueryable`1 query, String memberName, String direction) ....

I searched on many sites but did not get solution, then I start trial and run method on code. Finally I found that it was my silly mistake, 

Solution


SQL column name and what you passing in code should be same, its case sensitive

I was passing : countryName
SQL Column name: CountryName


Hope this will help you and save your time.

Enjoy !!!

:)

HTTP Error 500.19 - Internal Server Error

HTTP Error 500.19 - Internal Server Error




HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.


Solution:

Please check if there is any url rewriting tag is there in web.config file, if exists then remove it.


Hope this will help you and save your time.

Enjoy !!!

:)

ASP.Net - MVC C#| Error: The required anti-forgery form field "__RequestVerificationToken" is not present.

 

ASP.Net - MVC C#| Error: The required anti-forgery form field "__RequestVerificationToken" is not present.

I am using Membership.create user function, then the following error is occurring,
 
The required anti-forgery form field "__RequestVerificationToken" is not present.

How can I fix this?

Solution: 

 You have [ValidateAntiForgeryToken] attribute before your action. You also should add @Html.AntiForgeryToken() in your form.

 

Enjoy !!!

:) 

ASP.Net - MVC C#| Error : A claim of type 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' was not present on the provided ClaimsIdentity.


ASP.Net - MVC C#| Error : A claim of type 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' was not present on the provided ClaimsIdentity.


How to get enum description text, here is the code to achieve this.

Error:

A claim of type 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' or 'http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider' was not present on the provided ClaimsIdentity. To enable anti-forgery token support with claims-based authentication, please verify that the configured claims provider is providing both of these claims on the ClaimsIdentity instances it generates. If the configured claims provider instead uses a different claim type as a unique identifier, it can be configured by setting the static property AntiForgeryConfig.UniqueClaimTypeIdentifier.

Set below code in global.cs to get exact error of claim.

AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;

Actual error of claim:

A claim of type 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' was not present on the provided ClaimsIdentity.

Solution:

Your claim identity does not have ClaimTypes.NameIdentifier, you should add more into claim array:

var claims = new List<Claim>
{
    new Claim(ClaimTypes.Name, "username"),
    new Claim(ClaimTypes.Email, "user@gmail.com"),
    new Claim(ClaimTypes.NameIdentifier, "userId"), //should be userid
};

Enjoy !!!

:)

 

Error : Validation failed for one or more entities. See 'EntityValidationErrors' property for more details



Validation failed for one or more entities. 

See 'EntityValidationErrors' property for more details





To resolve this issue, you can find where is the issue using below code...


 catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                        eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                            ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }