2020年9月25日 星期五

System.ObjectDisposedException: 無法存取已處置的物件 (轉貼)

 這到底發生了什麼事情?

System.ObjectDisposedException: 無法存取已處置的物件
很正常的,微軟的中文版錯誤訊息不只難懂還可能讓人搞錯方向。他對應的英文訊息是:
Cannot access a disposed object.

這邊說的「已處置」就是"disposed",某個物件被處置掉了所以不能夠再被使用。

可能解法:

if (form1?.IsDisposed == true)
{
    form1 = new Form1(); 

} 

2020年9月23日 星期三

Unsafe Code C# 設定

 

To set this compiler option in the Visual Studio development environment

  1. Open the project's Properties page.

  2. Click the Build property page.

  3. Select the Allow Unsafe Code check box.






the following is a method declared with the unsafe modifier:

C#
unsafe static void FastCopy(byte[] src, byte[] dst, int count)
{
    // Unsafe context: can use pointers here.
}

The scope of the unsafe context extends from the parameter list to the end of the method, so pointers can also be used in the parameter list:

C#
unsafe static void FastCopy ( byte* ps, byte* pd, int count ) {...}

You can also use an unsafe block to enable the use of an unsafe code inside this block. For example:

C#
unsafe
{
    // Unsafe context: can use pointers here.
}

To compile unsafe code, you must specify the -unsafe compiler option. Unsafe code is not verifiable by the common language runtime.

2020年9月22日 星期二

解決"找不到或無法開啟 PDB 檔案"在Visual C++ 2015 Community (轉貼)

 解決"找不到或無法開啟 PDB 檔案"在Visual C++ 2015 Community (VC 2015)

上網找了一下都是舊文章

新的選項的位置不同。

解決方法

偵錯-->選項

1.png


偵錯-->符號-->把Microsoft符號伺服器打勾)

符號.png 

2020年9月14日 星期一

Positional and named parameters for C# attribute (轉貼)

 

Positional and named parameters

Attribute classes can have positional parameters and named parameters. Each public instance constructor for an attribute class defines a valid sequence of positional parameters for that attribute class. Each non-static public read-write field and property for an attribute class defines a named parameter for the attribute class.

The example

C#
using System;

[AttributeUsage(AttributeTargets.Class)]
public class HelpAttribute: Attribute
{
    public HelpAttribute(string url) {        // Positional parameter
        ...
    }

    public string Topic {                     // Named parameter
        get {...}
        set {...}
    }

    public string Url {
        get {...}
    }
}

defines an attribute class named HelpAttribute that has one positional parameter, url, and one named parameter, Topic. Although it is non-static and public, the property Url does not define a named parameter, since it is not read-write.

This attribute class might be used as follows:

C#
[Help("http://www.mycompany.com/.../Class1.htm")]
class Class1
{
    ...
}

[Help("http://www.mycompany.com/.../Misc.htm", Topic = "Class2")]
class Class2
{
    ...
}

the Attribute suffix may be omitted (轉貼)

 C#

using System;

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
public class SimpleAttribute: Attribute 
{
    ...
}

defines an attribute class named SimpleAttribute that can be placed on class_declarations and interface_declarations only. The example

C#
[Simple] class Class1 {...}

[Simple] interface Interface1 {...}

shows several uses of the Simple attribute. Although this attribute is defined with the name SimpleAttribute, when this attribute is used, the Attribute suffix may be omitted, resulting in the short name Simple. Thus, the example above is semantically equivalent to the following:

C#
[SimpleAttribute] class Class1 {...}

[SimpleAttribute] interface Interface1 {...}

2020年9月10日 星期四

高通的一些縮寫 (轉貼)

Ref: https://codertw.com/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80/42191/ 


晶片型號縮寫

SDM :Snapdragon Mobile

MSM :Mobile Station Modems

APQ :Application Processor Qualcomm

MPQ :Media Processor Qualcomm

QSD :Qualcomm Snapdragon


其他

TPP :Test Plan Package

MFG : 大概是 Manufacturing

CS :Commercial Software

DSDA :Dual Sim Dual Active

DUT :Device under test

EVP :Enhanced Power Verification

FC :Feature Complete

FFBM :Fast Factory Bootmode

FTM :Factory Test Mode

FTMRFT :FTM RF Test is a new FTM command set introduced on the Atlas modem. It replaces the FTM RF commandset used on other modems.

MM :Multimode

NSVFS :Non SignalingVerification Frequency Sweep

QSEQ :Qualcomm Test Sequencing Systems

RFVFS :RadioFrequency Verification Frequency Sweep

VFS :Verification frequency sweep

QMSL : QUALCOMM Manufacturing Support Library

QRCT : QUALCOMM Radio Control Tool

QPST : QUALCOMM Product Support Tool

QSPR : QUALCOMM Sequence Profiling Resource

XTT :QSPR subsystem test libraries and extensible test tree files

2020年9月8日 星期二

c#调用c++dll时const char*类型应该怎么对应 (轉貼)

 

c#调用c++dll时const char*类型应该怎么对应

等级 
勋章
Blank