Tag Archives: c#

Hololens2 reported an error. Microsoft.windows.system is missing

Assets\Microsoft.MixedReality.WebRTC.Unity\Scripts\Media\LocalVideoSource.cs(234,89): error CS0234: The type or namespace name ‘ProcessorArchitecture’ does not exist in the namespace ‘Microsoft.Windows.System’ (are you missing an assembly reference?)

Click the error reporting line to enter the code:

Method 1: modify the official code pre instruction   UNITY_ Wsa changed to   UNITY_ UWP

Method 2: directly delete the official judgment, and the code judges whether it is hololens1    , Return according to your judgment   True or false

  I use   Method two!

Debug error: abort() has been called error causes and Solutions

report errors

Error reporting reason

    pointer problems, such as illegal pointer access, pointer access out of bounds, memory leakage, memory out of bounds and insufficient memory allocation of multithreaded access resources. Check whether exe and DLL are mixed with different versions of CRT

    terms of settlement

      check that the requested space is not released. Check whether the stack space has been fully allocated. It is recommended that each memory allocation should not be too large, and remember that the release pointer points to an unexpected memory location

[Solved] C# connecting to MySQL database reports an error

C# is fine when calling mysql.data.dll to connect to the local database, but it reports an error when connecting to the mysql server on a remote Linux server
Error log, current connection string
System.Security.Authentication.AuthenticationException: Authentication to host ‘xxx.xxx.xxx.xx’ failed.
at MySql.Data.Common.Ssl.StartSSL(Stream& baseStream, Encoding encoding, String connectionString)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()

<add key="dbString" value="server=localhost;port=3306;user=root;password=root; database=id3net" />

If the host does not support SSL connection, then SSL connection will not be used

Solution: add sslmode = none after the connection string.

<add key="dbString" value="server=localhost;port=3306;user=root;password=root; database=id3net;SslMode=none" />

C# Error: Import “google/protobuf/timestamp.proto“ was not found or had errors. [How to Solve]

When using c# as the development language to convert Pb files into CS files, I believe many people will encounter a very difficult problem

The first question: in the protoc3 environment, import timestamp. In the header, import “Google/protobuf/timestamp. Proto”; Exceptions will be thrown when: Google/protobuf/timestamp. Proto “was not found or had errors;

Solution [sharing of original articles by blogger “pamxy”:

(Note: it was found later that it is not necessary to add this directory, because the timestamp.pb.cc file generated by timestamp.proto has been compiled as the source code when compiling libprotobuf.lib file, and libprotobuf.lib is also used in compiling protoc.exe, so it is natural to default that there is already a source code, so there is no need to import it again!)
Just delete the import “Google/protobuf/timestamp. Proto”.

Second question:  ” google.protobuf.Timestamp” is not defined.

Under normal circumstances, there is no need to import google.protobuf.timestamp directly in the protoc3 environment, because in the compilation process, the problem will be read in the Lib file, but if timestamp is called in the file, it is as follows:

It is necessary to call the timestamp file in the header, but bloggers are always prompted during the call  ” google.protobuf.Timestamp” is not defined.

There is really no way, so I have to find the path of this file: timestamp.proto file in protobuf master \ SRC \ Google \ protobuf folder, directly copy the file to the same level directory of the file you want to compile, and then modify the timestamp file in the header. The call path: Import “timestamp. Proto”;

Finally, the file was finally solved…….

The third question: how to call after converting the protocol file into a CS file?

a. Found in referenced project: Tools & gt& gt; Nuget package manager & gt& gt; Nuget package for management solution & gt& gt; Search for “Google. Protocolbuffers” and install

B, directly convert the protoc file into the CS file, and call it in the project.

This small problem is recorded, which is also convenient for you to use as a reference when you encounter this problem.

Stackexchange.redis data timeout [How to Solve]

StackExchange.Redis Error when loading large batch of hash data.
StackExchange.Redis.RedisTimeoutException: Timeout performing HGET Cache.IncomeShare.AccountData@Cache.IncomeShare.AccountData.InnerIncomeDistributionItem, inst: 1, mgr: ExecuteSelect, err: never, queue: 2, qu: 0, qs: 2, qc: 0, wr: 0, wq: 0, in: 0, ar: 0, clientName: xx, serverEndpoint: 192.0.x.x:6379, keyHashSlot: 10857, IOCP: (Busy=0,Free=1000,Min=6,Max=1000), WORKER: (Busy=0,Free=32767,Min=6,Max=32767) (Please take a look at this article for some common client-side issues that can cause。 timeouts: http://stackexchange.github.io/StackExchange.Redis/Timeouts)
According to the information to see IOCP and WORKER Busy are 0, will also report a timeout problem, is expected to be a StackExchange.Redis bug, the solution can be changed to use FreeRedis.

It can be opened with localhost, but not with IP address. The request host name is invalid

Problem point
the webapi compiled by vs can only be used

http://localhost:64734/API/Default/GETIP 

unavailable

http://127.0.0.1:64734/API/Default/GETIP

The solution is
1, find the. Vs folder

2, find the file D: desktop, webapiarduino. Vs, config, applicationhost. Config
the path depends on the project.

D:\Desktop\WebAPIArduino

After searching the localhost, change the localhost to *

the modified result

is valid.

Sys.webforms.pagerequestmanagerparsererrorexception: unable to parse message received from server

chinese:

Sys.WebForms.PageRequestManagerParserErrorException:

The message received from the server cannot be parsed. The common reason for this error is that response filters, httpmodules, or server tracing will be enabled when the corresponding message is modified by calling response. Write().

Details: error parsing nearby output.

The solution is as follows:

1. If the server control calling the response. Write() method is on the page using the UpdatePanel, you only need to add a node under the UpdatePanel and register the control with postbacktrigger. The code is as follows:

    < asp:ScriptManager ID= “ScriptManager1” runat=“server”>& lt;/ asp:ScriptManager>& lt; asp:UpdatePanel ID= “UpdatePanel1” runat=“server”> & lt; asp:PostBackTrigger ControlID= “Button2” />

    < asp:Button ID= “Button2” runat=“server” OnClick=“Button2_ Click” Text=“Button” />& lt; asp:UpdateProgress ID= “UpdateProgress1” runat=“server”>& lt;/ asp:UpdateProgress> & lt;/ asp:UpdatePanel>

    2. However, if the UpdatePanel is used in the master page, the above methods cannot be used to solve the problem. Otherwise, the following error may appear:

    A control with ID ‘btnExport’ could not be found for the trigger in UpdatePanel ‘UpdatePanel1’.

    This is mainly because updatepanel1 cannot be found & lt; asp:PostBackTrigger ControlID= “btnExport” /> Because we generally do not add this control (btnexport) to the master page( Of course, if a control with ID btnexport is added under the node of the UpdatePanel, there will be no error.)

    If there is such an error, what should I do?My solution is to use the page of the control page where the response. Write() method is needed_ Add the following code to the load event:
    ((ScriptManager) master. Findcontrol (“scriptmanager1”)). Registerpostbackcontrol (btnexport)
    // scriptmanager1 is & lt; asp:ScriptManager ID= “ScriptManager1” runat=“server”> & lt;/ asp:ScriptManager> ID of

    Reprint address: http://www.cnblogs.com/shenyixin/archive/2012/03/08/2385376.html

To solve the problem of C # calling excel interface error, prompt: the COM object of Microsoft. Office. Interop. Excel. Applicationclass is forcibly converted to the interface type “Microsoft. Offi”

Solve the problem of C # calling excel interface error, prompt: the COM object of microsoft.office.interop.excel.applicationclass is forcibly converted to the interface type of microsoft.office.interop.excel_ Application”。 This operation failed because the IID is “{000208d5-0000-0000-c000-000000000046}”

For more information about calling just in time (JIT) debugging instead of this dialog,
see the end of this message.

**************Exception text ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^_ Application”。 This operation failed because the queryinterface call to the COM component of the interface with IID “{000208d5-0000-0000-c000-000000000046}” failed with the following error: the library is not registered( Exception from HResult: 0x8002801d (type_ E_ LIBNOTREGISTERED))。

1. Run the “regedit” command to open the registry
2. In the registry address bar, enter:
Computer/HKEY_ CLASSES_ Root/typelib {00020813-0000-0000-c000-000000000046}
locate to the {00020813-0000-0000-c000-000000000046} folder
3. Delete the 1.9 folder under {00020813-0000-0000-c000-000000000046} (the author’s computer is office 2013, 1.8 and 1.9 folder coexist at the same time, delete the higher version)
4. Start the program again, OK

.NETproject compilation error. Type or namespace name could not be found. Visual studio automatically introduces dependency package (shortcut key)

Intro

Using visual studio to compile a. Net MVC project, many errors are reported in the following form:

CS0246	The type or namespace name 'xxx' could not be found (are you missing a using directive or an assembly reference?)
CS0246	Typ- oder Namespace-Name "xxx" nicht gefunden (fehlender Verwendungshinweis oder Assembly-Referenz?)

Screenshot:

Similar to in Java, if you directly use some class definitions without importing related packages, a similar error will be reported.

CS 0246 official document of error code: compiler error cs0246 | Microsoft docs

solve

In the above screenshot, the solution has been given:

is actually to add the correct class path using XXX .

However, in different versions of visual studio, does not introduce the same shortcut keys in the namespace where the class is located.

There are three ways to try:

Alt+Enter
Ctrl+.
Shift+Alt+F10

Of course, if you don’t know the shortcut key, but you know the full path (namespace, classname) of the class you are using, you should add using XXX at the beginning of the source code is OK.

Error handling when ABP specifies map object during map operation

Error handling in map operation of ABP

When mapping an entity object into dto in ABP, the entity defines an object of type long. In dto, there is an object with the same name, but the type is guid,

// StudentEntity
public class StudentEntity
{
		public Guid RelatedStudentId
		{
				get; set;
		}
}

// StudentDto
public class StudentDto
{
		public Guid StudentId
		{
				get;  set;
		}
		
		public Long RelatedStudentId
		{
				get; set;
		}
}

Take studententity and studentdto for example. Due to the change of business, when the back-end modifies the database and does not change the front-end code for the time being,

Directly map the relatedpatientid in entity to the studentID in dto , In this way, an error will occur when mapping, indicating that the type conversion error is wrong, and the data of the guid cannot be assigned to long,

CreateMap<StudentEntity, StudentDto>()
            .ForMember(d => d.StudentId, map => map.MapFrom(o => o.RelatedStudentId))

At this time, the entity’s guid type relatedpatientid will be mapped to the long type relatedpatientid in dto,

This kind of data definition should be avoided in map operation.

“XXXXXX is a” namespace “, but here it is used as a” type “

Recently, I encountered this problem several times when learning C #. When writing ArrayList and StringBuilder, the main function will report the error that “XXXXXX is a” namespace “, but it is used as a” type “here. After several times of searching for information, we finally know where the mistake is.

For the convenience of the diagram, you can name the project name directly as the class name. That’s the mistake. The priority of the namespace is higher than the class name. Just change the project name when you create a new project.

In short, avoid duplicate class and project names.

[unable to calculate item metadata “% (fullpath)” unable to apply item metadata “% (fullpath)” to path] problem solving

Recently, I downloaded a project from SVN to local. I encountered a problem in the process of opening it with visual studio. The problems encountered are as follows:

Cannot evaluate item metadata ‘% (fullpath)’. Cannot apply item metadata “% (fullpath)” to path “obj/debug/xxx… \ Basic.DomainModel.Model .dll”。

After searching in many ways, it is found that the problem is that the folder of this project is too long from top to bottom. Vs identifies the problem. That is to say, vs limits the total length of the file path in the project.

Solution: shorten the name of the upper folder where the. SLN file is located, or reduce the number of depth layers of the folder to a certain range.