Category Archives: Error

[Solved] NSwag Error: System.InvalidOperationException

Original address

https://github.com/RicoSuter/NSwag/issues/3584

Environment

ASP.NETCore:3.1

NSwag.AspNetCore:13.13.0

Throws an error

System.InvalidOperationException: Method may only be called on a Type for which Type.IsGenericParameter is true.
   at System.RuntimeType.get_GenericParameterPosition()
   at Namotion.Reflection.ContextualType.<get_Properties>b__42_0(PropertyInfo property)
   at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Namotion.Reflection.ContextualType.get_Properties()
   at Namotion.Reflection.ContextualTypeExtensions.GetContextualProperties(Type type)
   at NJsonSchema.Generation.JsonSchemaGenerator.ApplyAdditionalProperties[TSchemaType](TSchemaType schema, Type type, JsonSchemaResolver schemaResolver)
   at NJsonSchema.Generation.JsonSchemaGenerator.GenerateObject(JsonSchema schema, JsonTypeDescription typeDescription, JsonSchemaResolver schemaResolver)
   at NSwag.Generation.OpenApiSchemaGenerator.GenerateObject(JsonSchema schema, JsonTypeDescription typeDescription, JsonSchemaResolver schemaResolver)
   at NJsonSchema.Generation.JsonSchemaGenerator.Generate[TSchemaType](TSchemaType schema, ContextualType contextualType, JsonSchemaResolver schemaResolver)
   at NJsonSchema.Generation.JsonSchemaGenerator.Generate[TSchemaType](ContextualType contextualType, JsonSchemaResolver schemaResolver)
   at NJsonSchema.Generation.JsonSchemaGenerator.GenerateWithReferenceAndNullability[TSchemaType](ContextualType contextualType, Boolean isNullable, JsonSchemaResolver schemaResolver, Action`2 transformation)
   at NSwag.Generation.OpenApiSchemaGenerator.GenerateWithReferenceAndNullability[TSchemaType](ContextualType contextualType, Boolean isNullable, JsonSchemaResolver schemaResolver, Action`2 transformation)
   at NSwag.Generation.AspNetCore.Processors.OperationResponseProcessor.Process(OperationProcessorContext operationProcessorContext)
   at NSwag.Generation.AspNetCore.AspNetCoreOpenApiDocumentGenerator.RunOperationProcessors(OpenApiDocument document, ApiDescription apiDescription, Type controllerType, MethodInfo methodInfo, OpenApiOperationDescription operationDescription, List`1 allOperations, OpenApiDocumentGenerator swaggerGenerator, OpenApiSchemaResolver schemaResolver)
   at NSwag.Generation.AspNetCore.AspNetCoreOpenApiDocumentGenerator.AddOperationDescriptionsToDocument(OpenApiDocument document, Type controllerType, List`1 operations, OpenApiDocumentGenerator swaggerGenerator, OpenApiSchemaResolver schemaResolver)
   at NSwag.Generation.AspNetCore.AspNetCoreOpenApiDocumentGenerator.GenerateForControllers(OpenApiDocument document, IGrouping`2[] apiGroups, OpenApiSchemaResolver schemaResolver)
   at NSwag.Generation.AspNetCore.AspNetCoreOpenApiDocumentGenerator.GenerateAsync(ApiDescriptionGroupCollection apiDescriptionGroups)
   at NSwag.AspNetCore.Middlewares.OpenApiDocumentMiddleware.GenerateDocumentAsync(HttpContext context)
   at NSwag.AspNetCore.Middlewares.OpenApiDocumentMiddleware.GetDocumentAsync(HttpContext context)
   at NSwag.AspNetCore.Middlewares.OpenApiDocumentMiddleware.Invoke(HttpContext context)
   at NSwag.AspNetCore.Middlewares.SwaggerUiIndexMiddleware.Invoke(HttpContext context)
   at NSwag.AspNetCore.Middlewares.RedirectToIndexMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Treatment plan

Upgrade NSwag.AspNetCore class library to v13.13.1

Problem description

Before modification

<PackageReference Include=”NSwag.AspNetCore” Version=”13.13.0″ />

Cannot be opened after publishing, and an error is reported when opening locally

(1) Annotated all the methods below the Controller

Then the Swagger page can be opened, but the page has no available interface

(2) In combination with the error prompt type, it is thought that the messagemodel class has a generic t data attribute, and the return value is changed along with it

Now swagger is running normally, and the action is also displayed

(3) It is determined that the exception is caused by the messagemodel generic type, but I haven’t read the specific details

After modification

< PackageReference Include=”NSwag.AspNetCore” Version=”13.13.1″ />

The messagemodel is still returned and runs normally, so it is still a problem with the nswag class library

Uncaught SyntaxError: The requested module ‘/node_modules/.vite/react-router……Switch

I used vite to create a react project and reported an error when doing nested routing

The error prompt is the following code:

import { BrowserRouter, Route, Switch } from 'react-router-dom';

There is an error in the switch.

The NPM package version of the project at that time is as follows:

{
……
  "dependencies": {
    "react": "^17.0.0",
    "react-dom": "^17.0.0",
    "react-router": "^6.0.2",
    "react-router-dom": "^6.0.2"
  },
  "devDependencies": {
    "@vitejs/plugin-react": "^1.0.0",
    "vite": "^2.6.4"
  }
}

There is a switch method in the react route DOM, but the version may be too high and vite does not fit, so I choose to reduce the react route DOM to V5 version:

npm i [email protected]

Restart the project and the error will be solved~

 

[Solved] ORB SLAM2 Compile Error: /usr/bin/ld:Couldnot Find -lEigen3::Eigen

This error was reported at the beginning

Then delete the original eigen as required, install eigen 3.3.7, uninstall the original opencv, install opencv3.4.5, and install pangolin V6

This error is reported after loading. At first, people thought it was because they gave eigen. They wanted to manually set the path of eigen in cmakelists, but it was still useless…

When thinking about whether there is a problem with their own source code, they ran to the GitHub of orb slam2 for the next wave of source code, which is still useless

On the verge of giving up, I visited a wave of issues. Thank you, brother. I succeeded in the first one, so I didn’t try the second one,

It should be that C + + 17 adopted in pangolin version is incompatible with C + + 11 recommended by orb slam2

[Solved] document.onmousemove Error: Invalid or unexpected token

Today, there is a problem in the mobile event of writing a custom scroll bar with native JS. The scene is to click a div and move the div (ID: scroll_box) to make the scroll bar of the div beyond the fixed height move with it. The general normal logic is as follows:

let oScrollBox = document.getElementById('scroll_box');

oScrollBox.onmousedown = function(e) {
  let event1 = e || event;
  let positionY = event1.clientY - this.offsetTop;
  document.onmousemove = function(ev) {
    let event2 = ev || event;
    var divY = event2.clientY - positionY;
    oScrollBox.style.top = divY + 'px';

  }

  document.onmouseup = function() {
    document.onmousemove = null;
  };
}

At this time, the error will be reported.  

The event2 = ev || event; in the document.onmousemove method causes the error here, because the event variable is already used in the let event1 = e || event; above, so an error is reported. The solution is to write document.onmousemove into a separate In the method, so that you can avoid the variable duplication problem, the code is as follows:

oScrollBox.onmousedown = function(e) {
  let event1 = e || event;
  let positionY = event1.clientY - this.offsetTop;
  document.onmousemove = function(ev) {
    mouseMove(oScrollBox,ev,positionY);
  }
  document.onmouseup = function() {
    document.onmousemove = null;
  }
};
function mouseMove(obj,e,positionY) {
  let event2 = e || event;
  var divY = event2.clientY - positionY;
  obj.style.top = divY + 'px';
}

This can be solved perfectly!

[Solved] Error: Rule can only have one resource source (provided resource and test + include + exclude) in {

The horse’s fooled me for half an hour

The reason for this is that the version of webpack currently installed is too high compared with the version of the original project

Uninstall first

cnpm uninstall webpack -D

Then install version 4.0.0

cnpm install webpack@^4.0.0 -D

remote: ERROR: [28b83b5] missing Change-Id in commit message footer

Git submits an error to Gerrit because the changeid is lost

Solution: copy the whole line prompted in it and enter:

gitdir=$(git rev-parse –git-dir); scp -p -P 29418 [email protected] :hooks/commit-msg ${gitdir}/hooks/

Note that you must use git bash command window, because the following error messages may appear if you use vscode (special symbols are not recognized by the terminal here)

Then execute: git commit — amend

Done!

Mysqlbinlog Restore Data, ERROR 1105 (HY000) at line 152: Unknown error

Today, when using mysqlbinlog to recover data, various problems are always reported, one of which is

ERROR 1105 (HY000) at line 152: Unknown error

The commands I use are as follows:

 mysqlbinlog mysql-bin.000015|mysql -uroot -pxxxx -P3306

Later, thinking about narrowing the scope, we can only restore the common library and add the – D parameter.

 mysqlbinlog -d common  mysql-bin.000015|mysql -uroot -pxxxx -P3306

After executing all logs, the data returned to normal.

Error creating bean with name ‘com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration’

2021-11-30 23:52:19.074  WARN 42392 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Requested bean is currently in creation: Is there an unresolvable circular reference?
2021-11-30 23:52:19.081  INFO 42392 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-11-30 23:52:19.094 ERROR 42392 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The dependencies of some of the beans in the application context form a cycle:

┌──->──┐
|  com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
└──<-──┘

The springboot version conflicts with the PageHelper version. Adjust the version

primary

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.6.1</version>
	<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
	<groupId>com.github.pagehelper</groupId>
	<artifactId>pagehelper-spring-boot-starter</artifactId>
	<version>1.4.0</version>
</dependency>

After modification

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.3.12.RELEASE</version>
	<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependency>
	<groupId>com.github.pagehelper</groupId>
	<artifactId>pagehelper-spring-boot-starter</artifactId>
	<version>1.3.0</version>
</dependency>

Kibana Connect Error: Kibana server is not ready yet [How to Solve]

Problem description

An error occurs when the browser connects to kibana

Kibana server is not ready yet

View kibana log

{"type":"log","@timestamp":"2021-11-29T02:45:50Z","tags":["warning","elasticsearch","admin"],"pid":8,"message":"Unable to revive connection: http://120.79.137.87:9200/"}

reason

Check whether the configuration of kibana container startup is consistent with the following

docker run --name kibana \
-e ELASTICSEARCH_HOSTS=http://120.79.137.87:9200/ \
-p 5601:5601 \
-d kibana:7.6.2

In case of inconsistency, stop the container, delete it, and create a new kibana container again

Then kibana was started and an error was reported

{"type":"log","@timestamp":"2021-11-29T02:53:35Z","tags":["warning","savedobjects-service"],"pid":7,"message":"Another Kibana instance appears to be migrating the index. Waiting for that migration to complete. If no other Kibana instance is attempting migrations, you can get past this message by deleting index .kibana_1 and restarting Kibana."}

Solution

Stop the kibana service, and then delete the four indexes from elasticsearch

curl -XDELETE http://IP:9200/.kibana
curl -XDELETE http://IP:9200/.kibana*
curl -XDELETE http://IP:9200/.kibana_2
curl -XDELETE http://IP:9200/.kibana_1