. NET Exception Issues Summary

Source: Internet
Author: User
Tags xml attribute

the input string is not in the correct format. There are formatted character substitution symbols {0}, etc., "{" and "}" appear as special symbols, and if there is extra "{" and "}" error gzip compression appears ff-f0-f1 ... is an invalid input streamInvalid byte stream to decompress, possibly non-gzip compressed stream WebBrowser The specified conversion is not validCalling webbrowser across threads can only be performed by the thread directly by itself. Cross-threading operations require that the main thread asynchronously invokes the delegate method to perform the operation RTF to HTML has failed to convert the directiveThe RTF directive is unique, checking whether the replacement of a full double-byte character check is directly using a substitution that causes a similar string instruction that should not be substituted is illegally replaced and causes garbled registry operation, the subkey path cannot be preceded, otherwise there will be an exception with the wrong path, plus an absolute path Multi-threaded operations the same resource must be added lock Resource repeat definition multiple times? Generally because the copy code after the class name is not changed, resulting in 2 of the same name class, change the class name and constructor function name can be resolved the constructor on the XX class was not foundIt is possible to modify the default parameterless constructor and add a parameterless constructor again XMLDOM cannot be declared with XML when reading from a string XPath attribute arguments are quoted to pass through such as root/child[@name = ' Wang Xiaoming '), and XML is strictly case-sensitive,The full path is written "/name1/name2/:" relative to the path of the current node. Name1/name2″ would have thought he used it before. NET to crawl a few times the operation of the Web, compare to understand WebRequest, can today throw out a " cannot send with this predicate type"Abnormal, got a half-day to make uncertain, had to Google to check the SDK documentation.    Write a summary when you are done. If you want to submit a parameter to the specified page, WebRequest provides a stream, which can be written in the public virtual stream GetRequestStream () There are two places to watch. First, if it is submitted in a get way, the parameter is written directly to the URL of the WebRequest constructor, if it is submitted as a post, then the stream is fetched, the parameters are written into the stream, note that the method must be specified before writing the post. Second, the stream is closed after it is written. All of the three properties of HttpWebRequest should be preceded by a request flow write. Request. Method = "POST"; request. ContentType = "application/x-www-form-urlencoded"; request. ContentLength = postbuffer.length;using (Stream requeststream = Request.    GetRequestStream ()) {requeststream.write (postbuffer, 0, postbuffer.length); Requeststream.close ();}? If Method is set after requestStream.Write, an error "Unable to send content body with this predicate type" will appear, if ContentType is set after requestStream.Write, the data cannot be submitted correctly; If ContentLength is set after requestStream.Write, a "cannot set this property after writing start" error appears. Checklistbox Set the selected item with Setitemchecked, get selected with getitemchecked The postback or callback parameter is invalid. Event validation is enabled for use in configurations or for use in pages. For security purposes, this feature verifies that the parameters of the postback or callback event originate from the server control that originally rendered the events. If the data is valid and is expected, use the Clientscriptmanager.registerforeventvalidation method to register the postback or callback data for validation. 1. Whether the data-bound control is useful on the page, if so, place the IF (! IsPostBack) {}2.enableeventvalidation property is set to False3. Form nesting results in 4. My own problem is to empty the other controls before adding space, resulting in an error final summary: The data for a control is not getting or missing causing validation to fail CS Program release times wrong: Error 1. Unable to publish because a project could not be generated. 2. Signature is an error: This item is not suitable for use in a specified state. Workaround: Signature file problem, re-select the signature file (that is the original) on it. the type initializer for XX throws an exceptionThere is a problem with the value set in the static member or constructor too many items, a "circular dependency" prompt may occur when referencing! Checking for duplicate references, it's not going to work. Referencing related assemblies when opening projects individually using ClickOnce to implement manual updates requires System.Deployment.App ... To achieve control Form Coordinate transformation, the control form coordinate location is relative to the parent control's coordinates, but sometimes needs to be converted to the coordinates available to the top-level form, and if using the Control.Parent.PointToClient () method directly results in a coordinate exception, the workaround is to use the Control.Parent.PointToScreen () to screen coordinates, screen coordinates are fixed, can be used as an intermediate value, and then Control.findform (). PointToClient () to the form available valid coordinates, 3 hours of results!!! Console Title LengthString. length<=24500 exception Information Properties.Settings.Default.R_ShowSOYOUTryAlert "System.Windows.Forms.PropertyStore" does not contain " Settings "and cannot find an extension method" Settings "that accepts the first parameter of type" System.Windows.Forms.PropertyStore "(Is it missing a using directive or an assembly reference?) Error code: Properties.Settings.Default.R_ShowSOYOUTryAlert According to the exception information can be found that the system thinks Properties.Settings.Default.R_ Showsoyoutryalert is located under the System.Windows.Forms.PropertyStore, but this is not really the case Properties.Settings.Default.R_ Showsoyoutryalert is located under the Crmclient.properties, so as long as the namespace is complete, it may be that the form has its own separate configuration file, but the name is the same, resulting in system call error Multithreading cannot access freed resourcesThis problem has been bothering me for a long time, thinking that using control.isdisposed and control.disposing can tell if a control resource is released or is being released, but it is only found during debugging that these 2 properties don't reach the results I want, my solution is as follows: Defines a thread list, which is automatically deleted from the list after the thread executes, adds whether a thread can invoke the control thread's flag bit, sets the control flag bit when preparing to release the control resource, denies all threads from invoking the control, and avoids the exception that occurs when a thread invokes a control resource when the control is freed.

Attribute.GetCustomAttribute can be taken to a member Attribute

WebBrowser get no focusUse WebBrowser to do a chat with the text editor, all done to find every time after the message focus will be removed from the input box, no matter how the settings do not work, after debugging found that the original after the message was sent, the form of the show () method, resulting in focus loss WebBrowser does not display the added contentUse WebBrowser to do a chat content display control, but the first content is often not displayed, and later found that need after webbrowser.documentcompleted to be able to safely modify its content, if it does not wait for its loading after the completion of the modification of its content will appear this error too many items in combo box, the error prompt appears when the DisplayMember value of the member object is null in the ComboBox, with a strange exception prompt!!! Use bitmap to save the picture parameter setting System.Drawing.Imaging.Encoder.Quality value of 100 will be reported parameter error, need to change to 100L or (long) 100, can, obviously have an int type of overload, Why do I have to use long to take effect? DateTime.Now.ToString ("Yyyy/mm/dd") This method can only output YYYY-MM-DD, tested to use the escape character "", and is two times escaped, such as: DateTime.Now.ToString ("yyyy/ Mm/dd ") tested this problem no longer exists webconfig in the external environment after the modification, it is important to check its encoding, some tools such as FLASHFXP with text editing function, but its encoding is the default ANSI encoding, webconfig with UTF8 encoding, If the encoding is inconsistent and there is Chinese in the Webconfig the constructor should try not to use multi-threading, it is best to call WebService in the constructor after the end of the use of the WebMethod attribute method cannot be overloaded, To overload the need to set messagenameasp.net in the registration client script is invalid, view the source file also does not see the registered script block, indicating that the script registration failed, and later found that the original form is not server-side, missing runat= "server" An instance of the same listview in ASP. If it is added in more than one list control, modifying this instance affects all the list controls in ASP. Add custom Ihttpmodel After the page output is garbled in workaround 1. Add Meta on page Content-control:text/html;charset=utf-8 2. Use response.charset= "Utf-8″, but to remove Response.Flush () from the page, Otherwise, there's no content-control:text/html;charset=utf-8 in HHTP head. an ambiguous match was foundCheck that the server control ID has the same name as other variable names, including inconsistent case but with the same names, such as title and title, which belong to the duplicate ClickOnce deployment failure: The referenced assembly is not installed on the system empty x:documents and Settingsxxxxxxlocal Settingsapps The SelectCommand property has not been initialized before calling "Fill". There is no corresponding command or command in the adapter text or connection is invalid ================================================================ ======= The postback or callback parameter is invalid。 Use <%@ page enableeventvalidation= "True" in the configuration or in the pages%> enable event validation. For security purposes, this feature verifies that the parameters of the postback or callback event originate from the server control that originally rendered the events. If the data is valid and is expected, use the Clientscriptmanager.registerforeventvalidation method to register the postback or callback data for validation. The two days of development encountered a problem with the postback or callback parameter invalid. Use <pages enableeventvalidation= "true" in the configuration/> or use <%@ page enableeventvalidation= "true"%> to enable event validation. For security purposes, this feature verifies that the parameters of the postback or callback event originate from the server control that originally rendered the events. If the data is valid and is expected, use the Clientscriptmanager.registerforeventvalidation method to register the postback or callback data for validation.   found two days of information on the Internet did not result in the Sword Qi Xiao's article See the reason is: The following quote from: Jian qi xiaoxiao article http://www.cnblogs.com/asp600/archive/2006/11/04/550216. There are two things that ASPX has encountered so far: one is nested form, one page can have only one form, and the code can be resolved by careful examination. The second is the use of Ajax in the drop-down menu, common in the provincial and municipal linkage menu, may be due to the ASPX page assigned to the drop-down menu initial item value, in the event postback prompt the error, the drop-down menu initial item value is deleted, the item item is added in the binding event. I found out later that the problem was not there. The reason is that the Value property of the ListItem of the DropDownList control contains Chinese characters. Just change the value to English or digital. There is also a solution on the Internet: to put the enableEventValidation The property is set to false; The data is still not delivered to the server, resulting in a selectedindex value of 0. It is a good idea to add the following statement in Web. config: <globalization requestencoding= "utf-8″responseencoding=" utf-8″culture= "ZH-CN"Uiculture= "ZH-CN"/> Results, and now posted here hope to be helpful to everyone. It seems that ajax.net support for Chinese is limited, or because you want to set the encoding on Web. config?????? ref:http://www.cnblogs.com/dongyongjing/archive/2007/03/07/666427.html======================================== =============================== reflection modifies the confusion of private members: Always think that you are aware of the reflection, and that the members of the instance object are directly using the instance. GetType () will be able to obtain all of the reflection information, after the reflection of the private members of the test found that the private members can not be taken, unless the class is reflected to be taken to the full reflection of the console using multiple threads processing must be at the end of the last add Console.ReadLine () To block the main thread, or the console exits when the main thread finishes executing, and other threads will be rolled out if they are managed threads, and unmanaged threads may lose control. XML attribute values must be wrapped in single or double quotation marks, otherwise an error will be madeWhen using the monomer mode, it is important to note that this object is unique, and that any binding to his event is constantly added to the object, and if it is constantly added or causes the system to repeatedly invoke the event-handling method WebService HTTP Header not recognized http://xxx.com/sss ,The reason is that WebService changed the namespace in soap, and the application referencing the WebService did not update the reference or use the original service if the connection assigned to the command is in a locally suspended transaction. ExecuteNonQuery requires a command to have a transaction。 The Transaction property of the command has not yet been used for the SQL connection to be a transactional connection, but the transaction is not used on the command, the transaction property of the init command System.Diagnostics.Debug or System.Diagnostics.Trace's tradelistenercollection Use the same set, if a listener separate is added to debug and trace will be called two times: the system comes with a tracelistener of three: Defaulttracelistener,textwritertracelistener, EventLogTraceListener ASP. NET disable view state of GridView causes server control events in it to not fireThe ASP. NET server control uses the <%=xxx%> bind value is invalid, in the GridView or repeater the binding value to the server control can be used <%# bind ("Title")%>, but the property value to use single quotation marks, Otherwise, a parsing error will occur cannot create ' ORG '. Gedu. Cms. The constant value of the model.templatemodulearticle type. This context only supports primitive types or enumeration types. list<article> TMAs = Articleservice.findall ("Articlecategory"). Where (A = TMS. Select (t = = T.articleid). Contains (a.id)). ToList (); The red part is placed outside or changed to an array MVC with html.list () similar to the use of a method without a for the name must be able to find in ViewData, otherwise it will not work properly httprequest.appendheader Add an HTTP header the release version cannot be generated using VS, only the debug version can be generated:It is possible to refer to an assembly in the debug directory, take the assembly out and re-reference it. error message: Failed to convert the license file "Licenses.licx" to a binary resourceMicrosoft Visual Studio. NET 2002 Pro Solution: Remove the Licenses.licx file from the project and recompile. However, the direct deletion of the compiler will be prompted to find this file, because this file exists in the project file (xx.csproj), find the configuration section containing licenses.licx deleted can be compiled, if the Web site does not have a project file, you can right-click on the certificate, select "Raw To run-time license ", this time will be generated in the bin directory App_licenses.dll, if you use a component does not have a purchase authorization, there may be some authorization to purchase reminders, this time to delete the DLL to solve the problem, but the next release will also regenerate the file, There is also a solution on the Web: The build of the Licenses.licx property is changed from embedded resources to none, but this solution is not suitable for projects that do not include project files for Web sites. The data contract name should not be "arrayofint:http://schemas.microsoft.com/2003/10/serialization/arrays" for Type "system.int32[]". Consider using Datacontractresolver, or add any unknown type to a list of known types statically. For example, you can use the KnownTypeAttribute attribute, or add an unknown type to the list of known types that are passed to DataContractSerializer. There are many reasons for this problem: 1. Custom types do not have serialization and deserialization methods and need to implement ISerializable2 themselves. A generic base class is used, a generic parameter is a collection or an array type, and a generic base class implements serialization, where a known property of the type parameter is required on the subclass if the type parameter of the generic is a custom-defined sequence You need to add it as a known type "(datetime.now–starttime). ToString ("HH:mm:ss") "throws an exception of type" System.FormatException "string {system.formatexception}This is due to the incorrect format string, which is specific to the format string reference http://msdn.microsoft.com/zh-cn/library/windowsphone/develop/ee372286 (v=vs.105). ASPX and http://msdn.microsoft.com/zh-cn/library/windowsphone/develop/ee372287.aspx so the format string above should be changed to "hh": ' mm ': ' ss ' or @ ' Hh:mm:ss ", format string does not recognize" HH ", so you need to change lowercase" hh " . NET cannot load System.Data.Sqlite.dll assembly using Sqlite hintCheck the system version 32-bit or 64-bit, System.Data.Sqlite.dll is a system-sensitive, if the download is 32-bit, you need to build the target platform in the VS 32-bit.

. NET Exception Issues Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.