Windows error 0x80131509, -2146233079

Detailed Error Information

COR_E_INVALIDOPERATION[1]

Message"An operation is not legal in the current state."
Comment An operation is not legal in the current state.

HRESULT analysis[2]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode19 (0x013)
NameFACILITY_URT[2][3]
DescriptionThe source of the error code is .NET CLR.[2][3]
Error Code5385 (0x1509)

Questions

70votes
4answers

System.ServiceModel not found in .NET Core project

I have a .NET Core xUnit project. I'm trying to call a WCF service from it but get the following exception: System.InvalidOperationException occurred HResult=0x80131509 Message=An error occurred while loading attribute 'ServiceContractAttribute' on type 'IMyContract'. Please see InnerException for more details. Inner Exception 1: FileNotFoundException: Could not load file or assembly [...] read more
c#
.net
wcf
.net-core
20votes
4answers

Visual Studio 2013 is unable to open the Test Window

When I open Visual Studio 2013 and load my solution I'm greeted by an error message telling me the Test Window is unable to load. The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information. 1) Cannot compose part [...] read more
unit-testing
visual-studio-2013
mstest
visual-studio-test-runner
12votes
1answer

Adding identity server authentication to .NET Core 3 app fails with 'Key type not specified.'

I'm trying to add identity server authentication to a .NET Core 3 API project. I've added this code public void ConfigureServices(IServiceCollection services) { … var identityBuilder = services.AddIdentityServer(); identityBuilder.AddApiAuthorization<ApplicationUser, DbContext>(); services .AddAuthentication() .AddIdentityServerJwt(); var fileName = Path.Combine("Certificates", "certificatefile.pfx"); var cert = new X509Certificate2(fileName, "veryDifficultPassword"); identityBuilder.AddSigningCredential(cert); … } And: public void [...] read more
asp.net-core
.net-core
identityserver4
asp.net-core-3.0
asp.net-core-identity
12votes
1answer

add all the required services by calling 'IServiceCollection.AddHealthChecks'

I am using ASP.NET Core 3, .NET Core 3.0.100, Visual Studio 2019 Community. I follow this guide https://docs.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-3.0?view=aspnetcore-3.0#health-checks In Startup.cs, I add endpoints.MapHealthChecks("/health"); public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want [...] read more
c#
asp.net-core
blazor
.net-core-3.0
asp.net-core-3.0
8votes
2answers

Why does XmlSerializer fail to serialize enum value in .Net Core but works fine in .NET Framework

Summary .NET Core apps fail to XML serialize an object which contains an enum value, while .NET Framework (4.7.2) succeeds. Is this a known breaking change, and if so, how can I work around it? Code Example The following console application does not throw an exception in .NET Framework 4.7.2 [...] read more
c#
.net-core
xml-serialization
xmlserializer
6votes
2answers

Error "There was an error generating the XML document" while trying to install SQL Server 2017 unattended

I'm trying to install SQL Server 2017 unattended into a Windows 10 Azure virtual machine, via chocolatey using the following command on a remote powershell session: choco install sql-server-express -ia ""/IACCEPTSQLSERVERLICENSETERMS /FEATURES=SQLEngine /Q /ACTION=install /INSTANCEID=[INSTANCE_NAME] /INSTANCENAME=SQLCHEMETER /FILESTREAMLEVEL=1 /SECURITYMODE=SQL /SAPWD=[SA_PASSWORD] /UPDATEENABLED=FALSE"" -o -y" But the installation fails and the log file [...] read more
sql-server
azure
powershell
6votes
2answers

.NET Console App with Entity Framework Core: 'The process has no package identity' only when started without debugging

I have a .NET Console App integrated with Entity Framework and Discord Sharp Plus with the following libraries: * DSharpPlus * DSharpPlus.CommandsNext * Microsoft.EntityFrameworkCore.Design * Microsoft.EntityFrameworkCore.Sqlite * Microsoft.EntityFrameworkCore.Tools Running the application without debugging (Control + F5 in Visual Studio) works just fine, no crashes issued. However, if I run with [...] read more
c#
entity-framework
entity-framework-core
discord
dsharp+
5votes
2answers

Starting Azure Service Bus Trigger Function throws InvalidOperationException for "Host not yet started"

I have a v.2 Service Bus Trigger function which, when I attempt to start, throws the following exception: System.InvalidOperationException HResult=0x80131509 Message=The host has not yet started. Source=Microsoft.Azure.WebJobs.Host StackTrace: at Microsoft.Azure.WebJobs.JobHost.StopAsync() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\JobHost.cs:line 121 at Microsoft.Azure.WebJobs.Hosting.JobHostService.StopAsync(CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Hosting\JobHostService.cs:line 32 at Microsoft.Extensions.Hosting.Internal.Host.<StopAsync>d__10.MoveNext() I've searched around but cannot find anyone with a [...] read more
azure
azure-functions
azureservicebus
azure-servicebus-queues
5votes
0answers

ASP.NET Core React template - Can't find client id

I have created a ASP.NET Core 3.0 application using the React template configured with individual accounts login. I have since then upgraded it to version 3.1 and everything compiles and builds. However, at runtime I get the following error in the default controller namely OidcConfigurationController: System.InvalidOperationException HResult=0x80131509 Message=Client 'MyApp' not [...] read more
c#
reactjs
asp.net-core
5votes
1answer

Trouble posting CREATERAWTRANSACTION to Bitcoin Core via JSON-RPC

I'm trying to post to a local bitcoin full node via json-rpc but I'm getting an error from the server. Following the documentation here: https://bitcoincore.org/en/doc/0.17.0/rpc/rawtransactions/createrawtransaction/ I can see the following example structure for a createrawtransaction request: {"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"address\":0.01}]"] } My code creates the following [...] read more
c#
json
json.net
bitcoin
json-rpc
4votes
1answer

How to configure ConsoleLogger in console app?

I'm trying to build a console app, using .NET CORE 3.1, and I'm having a problem injecting a console logger. It looks like the way that logging is injected has changed significantly, in recent versions, and none of the various flavors of instructional tutorials seem to match what I'm trying [...] read more
c#
asp.net-core
.net-core
3votes
3answers

Could not find 'UserSecretsIdAttribute' on assembly but it exists and correct package is added

I follow this tutorial: https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-3.1&tabs=windows#access-a-secret To a .NET Core 3.1 project I've added Microsoft.Extensions.Configuration.UserSecrets package, I have clicked on the project to manage secrets, the file has been created in the AppData directory and the UserSecretsId has been added automatically in .csproj file. Because the Host.CreateDefaultBuilder didn't load secrets I [...] read more
asp.net-core
secretsmanager
3votes
1answer

C# Selenium Webdriver Exception | This version of ChromeDriver only supports Chrome version 85

MyChromeDriver My Google Chrome version: 88.0.4324.150 I found some solutions but the don't worked for me. I want to open Google Chrome throw the Selenium, but it don't work yet. Error System.InvalidOperationException HResult=0x80131509 Message=session not created: This version of ChromeDriver only supports Chrome version 85 (SessionNotCreated) Source=WebDriver StackTrace: at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response [...] read more
c#
selenium
selenium-webdriver
selenium-chromedriver
3votes
1answer

A key cannot be configured on 'ApplicationUser' because it is a derived type, but there is no key configuration on ApplicationUser

I'm trying to customize IdentityUser using ApplicationUser, I followed the steps in microsoft article, but when I run the application, I get this error on method base.OnModelCreating(modelBuilder);: > System.InvalidOperationException HResult=0x80131509 Message=A key cannot be > configured on 'ApplicationUser' because it is a derived type. The key must be > configured [...] read more
entity-framework
asp.net-core
asp.net-core-mvc
2votes
0answers

Visual Studio 2012 Very Slow Typing

I have a problem. After SP1 update, passing some time, VS 2012 becomes very-very slow when typing text. Solution size is not big, PC is quite powerful, it has 16GB of RAM, SSD drive, and i7-2600. I have attached using another VS and I see in debugger a lot of [...] read more
visual-studio
debug
visual-studio-2012
exceptions
2votes
1answer

StateSubscriber.Subscribe was not disposed

I'm developing a server-side application using Fluxor and the project now includes six Actions with a corresponding number of Reducers and Effects. At completion I expect there will be 20+ Actions with associated Reducers and Effects. Fluxor's state management is working well but as I build out the project I've [...] read more
dependency-injection
blazor
fluxor
2votes
2answers

WebView2 control not loading HTML string

WebView2 Control: As shown below, the HTML String successfully loads via NavigateToString(...) call inside Button_Click(...) event. But I need to have the HTML string loaded as soon as the Window and/or its Grid is loaded. But the following code either inside the constructor MainWindow(){...} or inside rootGrid_Loadded(...) event throws the [...] read more
c#
wpf
xaml
webview
webview2
2votes
1answer

DotNet not valid certificate found

I have seen this questions many times, but none of the answers works for me. My DotNet Core app fails The code: public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } the error: System.InvalidOperationException HResult=0x80131509 Message=Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could [...] read more
c#
.net-core
https
2votes
3answers

Join two IQueryable

The C# / Entity Framework problem: I have object Account { public string AccountId { get; set; } public string UserId { get; set; } public string CurrencyId { get; set; } } then I need to return all accounts on "user A" which have same currencyId as accounts for [...] read more
c#
entity-framework
linq
2votes
0answers

Autofac Injecting ClaimsPrincipal in Blazor Application

I'm facing issues with registering a service with Autofac in a Blazor application. Deep in a dependency I have a UserService which needs access to the current ClaimsPrincipal. I've wrapped that with IPrincipalProvider to avoid registering the ClaimsPrincipal directly. My issue stems from the fact that in Core the current [...] read more
c#
asp.net-core
.net-core
dependency-injection
autofac
2votes
1answer

Entity Framework DbContext is initialized with wrong constructor

In my ASP.NET Core Web API, I add the DbContext to services: services.AddDbContext<OpContext>(options => options.UseSqlServer(Configuration["DatabaseConnectionString"])); The problem is that my dbcontext as three constructors: public partial class UppContext : DbContext { public UppContext() : base() { } public UppContext(DbContextOptions<DbContext> options) : base(options) { } public UppContext(IIdentificationService idService) : base() { [...] read more
asp.net-core
entity-framework-core
dbcontext
2votes
1answer

Google Translate API Authentication

I just installed the google translate api but when I try to use it within visual studios it gives me this error; ` > System.InvalidOperationException HResult=0x80131509 Message=The Application > Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be [...] read more
vb.net
google-api
google-compute-engine
google-translation-api
2votes
2answers

Filtering using AsQueryable in Mongodb C# - ExpandoObject

I am trying to query the mongodb database using AsQueryable and LINQ functions. My current database structure is that I have some collections, mainly a record which are defined in C# like this: public class Record { [BsonElement("formName")] public string FormName { get; set; } [BsonElement("created")] public DateTime Created { [...] read more
c#
mongodb
linq
mongodb-.net-driver
2votes
2answers

C#.net Web Request could not get 404 custom error message while calling web API but postman does

I am calling external Web API in my own Web API using ServiceStack. For the unsubscribed user, external web API throws expected "404 Not found" exception with the custom message as "No subscriber with uuid: {...uuid sent}". I can see it in Postman enter image description here [https://i.stack.imgur.com/Xl7hp.png] but when [...] read more
c#
asp.net-web-api
servicestack
webrequest
2votes
1answer

Blazor Server and the Entity Framework. How to avoid multiple conflicting calls to the DB

Summary In my Razor page, a single user action fires off two events. These events result in calls to the EF which result in the error: > System.InvalidOperationException HResult=0x80131509 Message=A second operation > started on this context before a previous operation completed. This is usually > caused by different threads [...] read more
entity-framework
entity-framework-core
blazor-server-side
1vote
1answer

Simple Injector throws an error in Caliburn.Micro Bootstrapper.Buildup when calling async method in the viewmodel

I am trying to use Simple Injector as the DI container for Caliburn.Micro. Demo source: https://github.com/nvstrien/WPFDemos This project has a basic Caliburn.Micro setup with a Simple Injector Container. The ShellView has 1 button and when pressed, an async method is called to get some simulated data. I am getting this [...] read more
dependency-injection
caliburn.micro
.net-5
simple-injector
1vote
1answer

EF Core 3.1 throws an exception for Contains

I recently updated the project code into .NET Core 3.1 and EF Core 3.1, now most of my linq queries brake, EX. public override ICollection<ContactDetailModel> GetAll(ICollection<int> ids) { return _context .Set<TEntity>() .IgnoreDeletedEntities() .Where(x => ids.Distinct().Contains(x.ContactId)) .Select(EntityToDTOMapper) .ToList(); } This code throws an error where I use Contains, I saw in [...] read more
c#
asp.net-core
linq-to-sql
asp.net-core-webapi
ef-core-3.0
1vote
1answer

Azure.Search.Documents throws error while adding CORS to the Index (Programmatically)

I'm using azure cognitive search to index my data. I've upgraded to the latest Azure.Search.Documents (version 11) package. Previously I was using Microsoft.Azure.Search When I added CORS programmatically (Line No 5) I get the below error. Console.WriteLine("Creating Index..."); FieldBuilder fieldBuilder = new FieldBuilder(); var searchFields = fieldBuilder.Build(typeof(Hotel)); var searchIndex = [...] read more
c#
azure
azure-cognitive-search
1vote
1answer

How to convert lambda expressions to and from using boolean types

I was using the lambda expression conversion class from How can I convert a lambda-expression between different (but compatible) models? class name "TypeConversionVisitor". It's working well with model queries. When am trying to convert the below it's throwing exceptions.The below is the exception. Exception: System.InvalidOperationException HResult=0x80131509 Message=The binary operator Equal [...] read more
c#
.net
lambda
1vote
1answer

DataServiceContext.SaveChanges() throws Microsoft.OData.Client.DataServiceRequestException

In my Web App I am trying to update my Album. To do so, I have an OData Web API. I added the OData Web API service to my Web App using this tutorial. I am having a problem with calling the DataServiceContext.SaveChanges() after I called the DataServiceContext.UpdateObject. This is [...] read more
c#
asp.net-mvc
asp.net-core
odata
1vote
1answer

How to Debug "Source Not Available" WPF error

I have a WPF application that has started failing with the following error at start: System.InvalidOperationException: ''{DependencyProperty.UnsetValue}' is not a valid value for property 'BorderBrush'.' This exception was originally thrown at this call stack: [External Code] This is not very forthcoming about what has caused the error. I have tried [...] read more
c#
wpf
windows
stack-trace
1vote
0answers

2Dimentional Numpy array(NDarray) to C#: Linq Query returns limitations of Marshal.Copy error

I have implemented a ML model using keras in c#. The output is a 4dim vector. I have the following predict function to predict one entry. public (DateTime TimeStamp, double dim1, double dim2, double dim3, double dim4) Predict(ForecastControllPower input) => Predict(new List<ForecastControllPower>() { input }).First(); But I want to now [...] read more
c#
.net
linq
keras
1vote
0answers

Trouble sending createrawtransaction to bitcoin-qt via json-rpc

I'm trying to post to a local bitcoin-qt via json-rpc but I'm getting error 500 from the server. Following the documentation here I tried this code but it's giving the error 500, it works fine with other methods like getblockcount or getnewaddress Private Sub Button1_Click(sender As Object, e As EventArgs) [...] read more
vb.net
bitcoin
json-rpc
1vote
2answers

The instance of entity type 'Profile' cannot be tracked because another instance with the key value '{Id: 1087}' is already being tracked

I am using Entity Framework Core 5.0.0-preview.6.20312.4, Microsoft SQL Server 2019. I catch error > The instance of entity type 'Profile' cannot be tracked because another > instance with the key value '{Id: 1087}' is already being tracked. When > attaching existing entities, ensure that only one entity instance with [...] read more
c#
.net-core
entity-framework-core
1vote
0answers

Dependency Injection code for InMemoryDatabase in ASP.Net Core

I am working on a POC and need some data. Decided to use the following as a template: https://stormpath.com/blog/tutorial-entity-framework-core-in-memory-database-asp-net-core Followed the example. Except at opt.UseInMemoerydatabase("Files"). without the name it shows error. This is my code. It throws System.InvalidOperationException HResult=0x80131509 Message=Cannot resolve scoped service 'DataAPI.Models.FileContext' from root provider. at var context [...] read more
asp.net-core
dependency-injection
1vote
1answer

How can I construct a data model to bind to a SQL table with an XML column

I'm trying to use ASP.NET Core to read from a SQL database. I'm using Microsoft.EntityFrameworkCore.DbContext and I have it working except for any tables that have an XML column When try and read from one of these tables I get the following error: System.InvalidOperationException HResult=0x80131509 Message=The entity type 'SqlXml' requires [...] read more
c#
sql-server
asp.net-core-mvc
entity-framework-core
1vote
1answer

Appium desktop app test throws element could not be located exception, but passes when the app is launched before the test runs

I'm trying to learn Appium and using it for WPF application testing. Tests against Calculator or Notepad are running fine, but recently I've encountered a problem when trying to test custom WPF application. Appium desktop app tests throw "An element could not be located on the page using the given [...] read more
c#
appium-desktop
winappdriver
1vote
0answers

Basic Type-Generic EF Core 3.1 -> SQL Server Where Clause cannot be translated

Using EF Core, no matter what I do, I am unable to get the lambda in the Where statement to correctly evaluate to SQL. I have a basic generic LINQ query that takes an argument of type T where T :class, ICommonModel, this translates via a Repository that returns a [...] read more
c#
entity-framework-core
automapper
.net-core-3.0
1vote
2answers

Entity Framework code first migration is not working when authenticating SQL database using Azure Active Directory Application

I am using Entity Framework code first with db migration for our Azure SQL Server. Recently I tried to use Azure Active Directory authentication using this article https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication-configure. I am passing SQL connection to Entity Framework that is constructed using application access token. Everything works as expected but DB migration. [...] read more
entity-framework
azure
azure-active-directory
1vote
2answers

ssis error : foreach in foreach loop container

Thank you for answering the question. I check whether the variables contains null, however it's not the cause of null. Today, I find out why can not work. Because, the variable I set at variable mapping is as same as collection one too. So first loop works but next loop [...] read more
foreach
ssis
1vote
0answers

AlwaysEncrypted in ASP .Net Core 2.2 gets error Byte[]

I'm trying to use 'Always Encrypted' for ID client column in my table. Creating it in the SQL server was so easy. I tried to query in SSMS by activating in "Additional Connection Parameters" and type Column Encryption Setting=enabled. Run simple query and it works. But I get errors in [...] read more
sql-server
asp.net-core
azure-keyvault
always-encrypted
1vote
2answers

How can I discover why a Classic ASP page isn't responding to an HttpWebRequest?

> Prefix: Unfortunately, rewriting these Classic ASP pages into ASP.NET is not > an option. This is a complex legacy application that we're maintaining. I'm having trouble getting an HttpWebRequest to POST to a Classic ASP page within the same web application. The page works quickly and correctly in a [...] read more
asp.net
post
asp-classic
timeout
httpwebrequest
1vote
3answers

I'm trying to write a POST request to my API so that it can act on two separate objects(an insert and an update)

I'm trying to write this controller that accepts a POST request. I need this controller to add a new book, and also add that new books bookId to another object called a StoreList. So I am trying to pass in the new bookList, and the storeList that needs the bookId [...] read more
asp.net-core
asp.net-core-mvc
asp.net-core-webapi
1vote
1answer

Core scaffolding Oracle DB will give multiple ID(primary key's) as result

When I scaffold this Oracle DB (database -first) and it generates me all models, contexts, FK relations ect. But it gives me an error in the context when I start Querying. (simple things as select * from (any Table)) > The follow error comes up. > > System.InvalidOperationException > > [...] read more
oracle
entity-framework-core
asp.net-core-scaffolding
1vote
2answers

Could not load file or assembly

I've recently updated to the latest .net core 3.0 SDK, updated all my nugets to also include pre-release versions, however I keep getting this error come up when I try to do anything with Pomeolo / Entity Framework with MySQL. System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.2.0.0, Culture=neutral, [...] read more
c#
.net
entity-framework
1vote
1answer

Unable to connect RavenDB Cloud, in Microservice (AWS Lambda)

PROBLEM STATEMENT Trying to connect RavenDB Cloud service using AWS Lambda function, for one of my POC, but failed to connect. BACKGROUND I am using the client certificate (.pfx) file for this. It throws error exactly during certificate assign with X509Certificate2. I have converted the certificate to byte[] and passed. [...] read more
c#
microservices
ravendb
0votes
1answer

Windows 10 TP "Build Expired"

UPDATED QUESTION: I have an Asus PC, Windows 8.1 OEM. It was for someone who absolutely needed a start menu, so I jumped on the Win10TP when it first came out about a month after we got the PC. I believe I used the key provided by microsoft to get [...] read more
windows-8.1
windows-10
windows-10-upgrade
0votes
0answers

Updating Data on a OneNote Page Error, "Timeouts are not supported on this stream"

I have the goal of being able to programmatically update OneNote page data using C#. The Microsoft Graph API reference documentation suggests this can only be done by page element, not by page, and gives the following C# Graph SDK example: GraphServiceClient graphClient = new GraphServiceClient( authProvider ); var stream [...] read more
microsoft-graph-api
microsoft-graph-sdks
microsoft-graph-onenote
0votes
1answer

Upgrade Solution to use FluentValidation Ver 10 Exception Issue

Please I need your help to solve FluentValidation issue. I have an old desktop application which I wrote a few years ago. I used FluentValidation Ver 4 and Now I'm trying to upgrade this application to use .Net framework 4.8 and FluentValidation Ver 10, but unfortunately, I couldn't continue because [...] read more
fluentvalidation
0votes
1answer

How to use abstract class in Entity Framework Core?

Starting out with EF Core, I'm trying to use an abstract class. I understand that I can't instantiate an abstract class and have a part of code missing but cannot find how to solve it. The code is as follows: using System; using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; using Microsoft.Extensions.Logging; namespace ProjectTest1 [...] read more
c#
entity-framework-core
0votes
1answer

Microsoft.AspNetCore.Mvc.ViewFeatures.UnsupportedJavaScriptRuntime

I am new to Blazor and trying to run Javascript runtime in Blazor Webassembly (using ABP framework) to store in the local storage, but for some reason I am getting UnsupportedJavaScriptRuntime Error. I tried the same in Blazor server side and it worked. private async Task < Order > GetOrder() [...] read more
javascript
c#
.net
blazor-webassembly
abp
0votes
0answers

Hide HTML section in WordProcessingDocument object using OpenXML's Vanish Class

I am attempting to append an HTML page into a DocM file, and have the entire content hidden. As I understand, I need to use the Vanish class (https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.vanish?view=openxml-2.8.1) to achieve this. I streamed the HTML content into an AltChunk using the code provided here: https://stackoverflow.com/a/18152334/1243462 . I then try [...] read more
c#
ms-word
openxml
openxml-sdk
0votes
1answer

XSD Serialization to complex object

I am working with an XML document supplied by a vendor that I used XSD to convert to a serializable object. Here is the template xml they provide. <?xml version="1.0" encoding="UTF-8"?> <doi_batch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.crossref.org/schema/4.4.2 https://www.crossref.org/schemas/crossref4.4.2.xsd" xmlns="http://www.crossref.org/schema/4.4.2" xmlns:jats="http://www.ncbi.nlm.nih.gov/JATS1" xmlns:fr="http://www.crossref.org/fundref.xsd" version="4.4.2"> <head> <doi_batch_id>arg_123_954</doi_batch_id> <timestamp>20190430133609</timestamp> <depositor> <depositor_name>Crossref</depositor_name> <email_address>pfeeney@crossref.org</email_address> </depositor> <registrant>Society of Metadata Idealists</registrant> [...] read more
xml
xsd
xml-serialization
0votes
1answer

EnsureCoreWebView2Async not ready even after CoreWebView2InitializationCompleted event

As per Microsoft's Getting Started with webView2 in Windows Forms (as of 2021 March 9), I've got the following code (with webView2.source not set; edited out of Form.Designer.cs): public Form1() { InitializeComponent(); InitializeAsync(); } async void InitializeAsync() { Console.WriteLine("InitializeAsync starting"); await webView2.EnsureCoreWebView2Async(null); Console.WriteLine("InitializeAsync done"); } private void Form1_Load(object sender, EventArgs [...] read more
c#
winforms
webview2
0votes
0answers

How to configure one-to-many when the FK/PK is in a common Entity base class

Given the following classes that models a TPT inheritance using EF Core 5: public abstract class Entity { public int Id { get; set; } public int PartitionId { get; set; } public Company Company { get; set; } } public class Employee : Entity { } public class Company [...] read more
c#
entity-framework
entity-framework-core
0votes
0answers

Fluent assertion - compare empty objects

I'm generating a C# solution using another project. The generated solution contains multiple classes and a unit test file for each class. A unit test creates two instances of a class and compares them. For the comparison, I chose FluentAssertion (I tried other external comparators like ComareNetObjects, but it took [...] read more
c#
code-generation
fluent-assertions
0votes
0answers

ASP.NET MVC : could not find endpoint element with name contract

I had created an MVC application that had no authentication so I was advised to create a mvc project that has the 'Individual User Accounts' option selected which brings with it some controllers, models and views. What I had done to keep my old class library data was rename the [...] read more
c#
asp.net-mvc
0votes
1answer

Problems connecting to Database using ODBC and VB Project

EDIT 3 I have used the provided links to change the connection, which works :) now I have this message for every record pulled from my database Error Screen EDIT 2: No reason for ODBC, just it was the first result, code is below I am running VS Studio 2017 [...] read more
vb.net
odbc
azure-sql-database
0votes
0answers

I need export DbContext to library in nuget package for reutilize in various projects

i have this code in my library Entrega.cs [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public string NumeroDeEnvio { get; set; } public int MotivoId { get; set; } public int SubmotivoId { get; set; } public string SucursalId { get; set; } public string CodigoComprobante { get; [...] read more
c#
.net
entity-framework
nuget-package
dbcontext
0votes
1answer

Registering class by multiple abstractions while creating the type by hand

I want to register class Foo and its interface IBar. var b = new DbContextOptionsBuilder(); b.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=Connect.Device;Trusted_Connection = True; MultipleActiveResultSets = true;"); _container.Register(() => new DeviceContext(b.Options), Lifestyle.Scoped); _container.Register<IFoo, DeviceContext>(Lifestyle.Scoped); _container.Register<IDeviceTypeService, DeviceTypeService>(Lifestyle.Scoped); This does not work. This is the exception which is thrown on call to Verify: > System.InvalidOperationException HResult=0x80131509 Message=The configuration [...] read more
c#
simple-injector
0votes
2answers

No service for type 'Polly.Registry.IReadOnlyPolicyRegistry`1[System.String]' has been registered

There is an extension method that registers IAccountSearchServiceClient with some policy handlers looks like Polly lib is used public static IServiceCollection AddAccountSearchServiceClient(this IServiceCollection services) { services.AddHttpClient<AccountSearchServiceClient>() .ConfigureHttpClient((sp, client) => { var options = sp.GetRequiredService<IOptions<AccountSearchSettings>>(); var settings = options.Value; client.BaseAddress = settings.BaseUrl; }) .ConfigurePrimaryHttpMessageHandler(() => { var handler = new HttpClientHandler [...] read more
.net-core
dotnet-httpclient
polly
0votes
0answers

How can I avoid Tracking error when deleting the same ID twice?

I implemented a simple Delete method in my ServiceStack Service class as follows... public void Delete(DeleteCompany d) { Company c = new Company(); c = ctx.Companies.AsNoTracking().FirstOrDefault(m => m.id == d.id); if (c == null) { return; } ctx.Companies.Remove(c); ctx.SaveChanges(); } ctx is populated via Dependency Injection. This works great the [...] read more
entity-framework-core
servicestack
0votes
1answer

Failure Entity Framework Core 3.2 update while entity has association with Identity User

Here is a new issue. Trying to update entry in the Database. Note, this entry has dependency on User. I conducted the same logic I used to do when I didn't have user association with the item without any issue. However, now it is giving me grief. Here is the [...] read more
c#
asp.net-mvc
asp.net-core
tracker-enabled-dbcontext
0votes
1answer

Linq query in Entity Framework Core 3.5.1

I have tried every variation of this query in EF Core and I cannot figure it out. I have simplified this as such: Invoice Table InvoiceId stuff 1 A 2 B InvoiceLog Table Id InvoiceId Date PersonId 1 1 11/12/2015 1 2 2 1/20/2018 2 3 2 3/15/2019 3 Person [...] read more
c#
linq
entity-framework-core
0votes
0answers

Sqlite bulk insert with fresh transaction of a batch

I need to populate a Sqlite table with precalcutated values. Only one table with currently ~20 rows. After fiddling around a day or two I managed to got the approach 1 working with bulk inserts which works great for "smaller amounts of entries" (5_000_000 records) and it's quite fast. Unfortunately [...] read more
c#
sqlite
.net-core
0votes
1answer

How to use Linq or Lambda with IQueryable to GroupBy and get the first/last record on the collection in C#?

I'm using Entity framework core 3.1 to connect to the database, what I'm trying is to get the Highest and lowest product details which grouped by its category id. based on answers shown on this question and this question I tried to write the following code: using Linq : //NOTE: [...] read more
c#
linq
entity-framework-core
0votes
0answers

Starved Dispatcher's message pump?

I'm developing a C#/WPF Application running lengthy data Uploads to a server. For this, I launch a dialog window, which launches a backgroundWorker thread. The worker thread processes the file uploads. The UI Updates are done with Application.Dispatcher.BeginInvoke() calls. The file uploads use HttpClient, calling Task.Run() for the async part. [...] read more
c#
.net
wpf
multithreading
0votes
1answer

Upgrading Asp.Net Core 2.2 to 3.1 using Microsoft.Identity.Web - No authentication handler is registered for the scheme 'AzureADJwtBearer'

I'm in the process of updating an Asp.Net Core 2.2 application to 3.1. We use Microsoft.Identity.Web to handle Azure AD authentication. I changed our security configuration as as follow: ConfigureSerivces services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApi(configuration) .EnableTokenAcquisitionToCallDownstreamApi() .AddInMemoryTokenCaches(); services.AddAuthentication() .AddScheme<ApiKeyAuthenticationSchemeOptions, ApiKeyAuthenticationHandler (AuthenticationSchemes.ApiKey, null); And Configure app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseMiddleware<LogUsernameMiddleware>(); app.UseEndpoints(p => { p.MapControllers(); }); [...] read more
asp.net-core
.net-core
msal
0votes
2answers

Migrating from ASP.NET CORE 3.0 to 3.1

I'm trying to migrate my project from asp.net core 3.0 to 3.1 and I have found one issue: public static bool CheckConnection(this DataContext dataContext) { try { return dataContext.Database.CanConnect(); } catch(SqlException) { return false; } } this code worked in version 3.0, but when I have migrated I got this [...] read more
c#
asp.net-core
asp.net-core-3.1
0votes
0answers

Can I Allow my RouteTemplate to Being With an '/' Character?

I have the following method within my API controller in an AngularJS WebAPI/MVC project: [Route("GetRecordByID/{metricID:string}")] [ResponseType(typeof(Metric_Approval_Data))] [HttpGet] public Metric_Approval_Data GetRecordByID(string metricID) { Metric_Approval_Data arecord = null; try { arecord = dbContext.Metric_Approval_Data.Where(x => x.Metric_ID == metricID).SingleOrDefault(); } catch (Exception e) { arecord = null; } return arecord; } This method should [...] read more
c#
angularjs
asp.net-mvc
asp.net-web-api
controller
0votes
0answers

Can't download multiple pdfs in c#

Recently I tried downloading multiple pdf files in C# for a project I am working on. here's my code snippet: private static void GetPdf() { for (int i = 0; i <2; i++) { using (var client = new WebClient()) { client.Headers.Add("User-Agent: Other"); if (i == 0) { client.DownloadFile("https://files.geva.co.il/geva_website/uploads/2020/06/36371-2020.pdf", "ElectricityQ.pdf"); [...] read more
c#
http
webclient
downloadfile
0votes
1answer

Core 3.1 EF 6 in Database-first: unable to determine the many-to-many relationship

I have a problem with using EF "database-first" in Core 3.1 with many-to-many relationship. There are two tables: ResourcesAZEZ and AsezPoolFileStore And third table AsezPoolFileLink, which contains only two columns: idRes and idFile Auto-generated code of that classes: public partial class AsezPoolFileStore { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public AsezPoolFileStore() { this.ResourcesAZEZs = [...] read more
entity-framework
entity-framework-core
asp.net-core-3.1
ef-core-3.1
0votes
1answer

Serialize error for a class not present in class being serialized

I'm trying to serialize data but a strange error occurs: System.InvalidOperationException HResult=0x80131509 Message=There was an error generating the XML document. Source=System.Xml StackTrace: at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o, XmlSerializerNamespaces namespaces) at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o) at Starbreaker.Form1.Form1_FormClosing(Object sender, FormClosingEventArgs e) [...] read more
c#
serialization
0votes
0answers

Switch between DisplayTemplate in MVC DisplayFor

Is it possible to switch DisplayTemplate like below when we consume in different cshtml pages? Data1 and Data2 are two cshtml DisplayTemplates but referring same Data1 model. If we are using without template name, its working and taking the Data1 template. cshtml1. DisplayFor(m=>m.Data1List,"Data1") cshtml2. DisplayFor(m=>m.Data1List,"Data2") I have received error like [...] read more
c#
asp.net-mvc
0votes
1answer

Attribute routes with the same name 'upload' must have the same template

I have 2 controllers using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using shadow.Data; using shadow.DTO; using shadow.Models; using shadow.Services; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; namespace shadow.Controllers { [Route("[controller]")] [ApiController] public class UserTrustedPersonController : ControllerBase { private IUserService _userService; [...] read more
c#
asp.net-core
0votes
0answers

In a non-UI application, how do I handle "The calling thread cannot access this object because a different thread owns it"

I've read through the discussion at The calling thread cannot access this object because a different thread owns it but it's all about UI. I have two C# EXEs that are purely command-line, but are throwing this error as well. Perhaps the full exception message will help: System.InvalidOperationException HResult=0x80131509 Message=The [...] read more
c#
multithreading
clearscript
0votes
1answer

Model backing the '...' context has changed since the database was created

I have enable-migration as well enablemigration=true. But i have table definition to save all form fields. Its keeps throwing this error. " System.InvalidOperationException HResult=0x80131509 Message=The model backing the 'eNtsaRegistration' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269)". What i want [...] read more
c#
sql-server
entity-framework
data-migration
0votes
0answers

EDMX canvas and generating a database from Model question

I generated the database from the model now I notice that all the tables have an "s" appended to then Userid object transloated to Userids in SQL. which nwhen I run the code Userid userid = db.Userids.Find(id); gives me this error: System.InvalidOperationException: 'The entity type Userid is not part of [...] read more
c#
entity-framework
edmx
edmx-designer
0votes
3answers

Using correct ChromeDriver.exe but still getting driver version error message

so the issue I'm having is when I try to run my automation tests with the Chrome Web browser, I get the following error message: System.InvalidOperationException HResult=0x80131509 Message=session not created: This version of ChromeDriver only supports Chrome version 80 (Driver info: chromedriver=80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}),platform=Windows NT 10.0.17763 x86_64) (InsecureCertificate) Source=WebDriver StackTrace: at [...] read more
selenium
google-chrome
selenium-chromedriver
visual-studio-2019
0votes
1answer

Can you use microsoft bot framework 4.9 to build a bot with core 3.1?

I created an EchoBot with the Bot Framework template, installed the bot framework 4.9, and then changed the target .Net version to Core 3.1. Now, I get the following error: System.InvalidOperationException HResult=0x80131509 Message=Endpoint Routing does not support 'IApplicationBuilder.UseMvc(...)'. To use 'IApplicationBuilder.UseMvc' set 'MvcOptions.EnableEndpointRouting = false' inside 'ConfigureServices(...). Source=Microsoft.AspNetCore.Mvc.Core How do [...] read more
c#
.net
asp.net-core
botframework
0votes
0answers

Exception when getting HTML from URL

I'm trying to get HTML from a URL so I can strip it down using Boilerpipe. However, I keep on getting an exception. I am using the NewsAPI to get my URLs. Here is the relevant code snippet: foreach (var article in articlesResponse.Articles) { string html; string url = article.Url; [...] read more
c#
boilerpipe
0votes
1answer

How can I fix my timer algorithm problem?

I wish to find the problem of this code which gives that the application is in break mode Exception unhandled. What can I try? > System.InvalidOperationException occurred HResult=0x80131509 Message=An error > occurred creating the form. See Exception.InnerException for details. The > error >> > is: Object reference not set to [...] read more
vb.net
timer
visual-studio-2017
0votes
1answer

How to import mysql tables with data through odbc and vb.net

i am working with data that needs updated from a third party source. My problem is that i need to allow my program to automatically do this from an odbc connection. i get the error; it is a very large file but it will fit into a string. The sql [...] read more
mysql
sql
vb.net
0votes
0answers

Why do I get an "System.IO.FileLoadException: Could not load file or assembly" error? with iText7

I'm developing AWS Lambda project with .Net SDK (Core 2.1). I need to use iText7 in my project. When I want to debug the project throws below exception. System.IO.FileLoadException: Could not load file or assembly 'itext.kernel, Version=7.1.10.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca'. An operation is not legal in the current state. (Exception from [...] read more
c#
asp.net-core
aws-lambda
itext7
aws-sdk-net
0votes
1answer

c# Trying to download a file with WebClient that contains a special character in filename

I'm trying to download a file with a special character 'Ç' for example in the filename, I get an exception with that character in the URL string. System.Net.WebException HResult=0x80131509 Message=The remote server returned an error: (404) Not Found. Source=System.Net.Requests For example: http://www.somesite.com/abcdç.pdf would create an exception in the WebClient. What [...] read more
c#
webclient
0votes
0answers

Sqlite IDbConnection - BeginTransaction Execption

I have a Sqlite/C# Application and want to start a transaction but i always get this execption: > System.InvalidOperationException HResult=0x80131509 message= The operation is > invalid due to the current state of the object. > Quelle = System.Data.SQLite Stapelüberwachung: bei > System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel > isolationLevel) bei > System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction() > bei CsvCompare.database.importCSVtoDB(List`1 [...] read more
c#
database
sqlite
transactions
insert
0votes
1answer

ANTLR PopMode: InvalidOperationException

I've been trying to debug this error, but am at a loss for what the cause is. From what I can tell through the stack trace, it is occurring when the PopMode action occurs. The exception occurs when I begin to walk the tree. If I remove the PopMode action [...] read more
antlr
antlr4
0votes
1answer

Remove the timestamp from a map in C#

I am getting an error when attempting to to remove the timestamp from a Map and was wondering if there were any way that this would be possible? AutoMap(); Map(m => m.BeginDate.Value.ToShortDateString()).Name("Delivery Begin Date").Index(0); I am getting the error: System.InvalidOperationException HResult=0x80131509 Message=No members were found in expression '{expression}'. Source=CsvHelper StackTrace: [...] read more
c#
datetime
csvhelper
0votes
1answer

EF Core 3.1 property is of type 'Nullable<Guid>' which is not supported by current database provider

Moving over from .net Framework EF 6.4, did something similar for years. Just trying to use a Guid datatype with SQL Server db, getting this error - this should just work, right?? If I remove applyconfigurations in the DbContext.OnModelCreating then it works (must be using default). System.InvalidOperationException HResult=0x80131509 Message=The property [...] read more
entity-framework-core
.net-standard-2.0
0votes
3answers

WPF ShowDialog again/several times

i´ve got an WPF application with an "settings-winwow". if i´m clicking on "info" on the mainwindow, settings.showDialog(); is called - so far so good. It opens and i can do some stuff, bus when i´m closing it and try to open it again, it gives me an error. its called: [...] read more
wpf
0votes
2answers

Managed CSOM on Sharepoint 201. Could not create SSL/TLS secure channel

I have a Windows Server 2016 VM and Visual Studio 2017 Community Edition. I am writing a simple script just to check the connectivity with the Sharepoint 2013. The Sharepoint Server is NOT installed on the VM, it is somewhere within the intranet. using System; using System.Collections.Generic; using System.Linq; using [...] read more
ssl
sharepoint-2013
csom
0votes
1answer

How to create a token using Aes128CbcHmacSha256

I can create a symmetrically signed jwt token using the HmacSha256 algorithm using this dot net core 2.2 code. using System; using System.Text; using Microsoft.IdentityModel.Tokens; using System.IdentityModel.Tokens.Jwt; namespace ConsoleApp1 { class Program { static void Main(string[] args) { var securityKey = "7iMdnuwf7XMMKGXGSMHKcs+qicGCinCJONLPrhGOX94="; var symmetricSecurityKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(securityKey)); var signingCredentials = [...] read more
.net-core
jwt
0votes
0answers

System.InvalidOperationException: 'An error occurred creating the form

Upon trying to run/debug code of a WindowsForm I run into the following exception: > System.InvalidOperationException HResult=0x80131509 Message=An error occurred > creating the form. See Exception.InnerException for details. The error is: > Object reference not set to an instance of an object. Source=Automated > SoundPower Testing StackTrace: at > Automated_SoundPower_Testing.My.MyProject.MyForms.Create__Instance__[T](T [...] read more
vb.net
visual-studio
0votes
0answers

SSIS SQL Agent job - Error: for each sub folder : The get enumerator method of the for each enumerator

I have a SSIS Package , which runs fine in Visual studio. The package uses a for each file loop and the variable points to a folder like this: \\server\d$\foldername\subfolder\ When I deploy the package on SSMS, when I execute the package I get the following error: Error 1: FLC [...] read more
ssis
0votes
1answer

How to deserialize from XML after adding an attribute?

I had a class similar to this: public class Script { public string Name { get; set; } public string HomeKey { get; set; } = ""; } which would deserialize from an XML file like this: <Script> <Name>ScriptName</Name> <HomeKey>KeyText</HomeKey> </Script> This works fine using the following code: [Test] public [...] read more
c#
xml
serialization
0votes
0answers

Microsoft.ACE.OLEDB.12.0 Is not registered, unable to fix after Access Database Engine 2010 download

This error drives me crazy. I have added an access DB to my project as a data source (to bind it with components in my form) and because of this not only that I am unable to connect to the database, but I am also unable to run the whole [...] read more
c#
ms-access
installation
oledb
-1votes
0answers

C# BackgroundWorker throws InvalidOperationException in RunWorkerCompletedEventHandler

The result of my BackgroundWorker throws an InvalidOperationException in the RunWorkerCompletedEventHandler. It occurres on cancellation and complete. The events of the GUI occurres fine, the worker.processChange(...) works fine and the RunWorkerCompletedEventHandler (which is in the MainWindow.xaml.cs) works also fine. The cancelation of the Task.Delay(...).Wait() works fine too. MainWindow.xaml.cs: public partial [...] read more
c#
multithreading
backgroundworker
-1votes
0answers

how to call a function on main thread (clear a datagridview) in c# with async call from cefsharp (winforms)? - dotnetcore

Relatively new to C# threading and ran into a situation whereby an async call is made using cefsharp that scrapes a table from a site (using a headless call). That part works fine, however, I need to clear and repopulate a DataGridView on the main form, and get an error [...] read more
c#
multithreading
winforms
asynchronous
cefsharp
-1votes
2answers

Nonexistent code, referencing a color, is breaking my app

In my Application resources I have <Application.Resources> <Color x:Key="SMSBlue">#008CFF</Color> </Application.Resources> And somewhere in a control template in a Window I have <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter TargetName="Panel" Property="Background" Value="{StaticResource SMSBlue}"/> <Setter TargetName="Header" Property="Foreground" Value="White"/> </Trigger> <Trigger Property="TabIndex" Value="0"> <Setter TargetName="Header" Property="Foreground" Value="Red"/> </Trigger> </ControlTemplate.Triggers> The window renders fine in the [...] read more
wpf
xaml
-1votes
2answers

Exception: Nullable object must have a value while typecasting in a Linq query

I have a Linq statement as below if (!inspectionItemIds.Contains((int)item.InspectionItemId)) { inspectionItemIds.Add((int)item.InspectionItemId); } And item.InspectionItemId is coming as null and its throwing me exception as below: System.InvalidOperationException HResult=0x80131509 Message=Nullable object must have a value. Source=mscorlib StackTrace: at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Nullable`1.get_Value() at IMS.Model.DomainLogic.ViolationManager.<>c__DisplayClass19_0.<ViolationsFor>b__9(Violation item) in C:\SourceCode\IMS\Development\IMS\IMS.Model\DomainLogic\ViolationManager.cs:line 254 at System.Collections.Generic.List`1.ForEach(Action`1 action) at [...] read more
c#
linq
-2votes
0answers

vbs(8,1) (null) : 0x80131509 error while running .vbs using ssh to windows

I am trying to run a vb script using ssh hook in airflow. When I try to run the same cscript vb script command on windows command prompt it works fine. but when i try to run it from airflow which is doing ssh to same windows machine I get [...] read more
linux
ssh
vbscript
airflow
-2votes
1answer

The calling thread cannot access this object - NOT AN UI OBJECT

EDIT I removed my code as it was incomplete and confusing, but added a minimal reproducible exemple. All the text below has been slightly rewritten to clarify my question, adding information from the comment, but without adding anything I didn't know when asking the question, in order to keep the [...] read more
c#
multithreading
dispatcher
multitasking

Comments

Leave a comment

(plain text only)

Sources

  1. https://github.com/dotnet/coreclr/blob/v1.1.0/src/inc/corerror.xml
  2. https://msdn.microsoft.com/en-us/library/cc231198.aspx
  3. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0