'library/.NET'에 해당되는 글 4건

static 클래스가 있는데 Initialize함수로 명시적 초기화를 하고 있다. 이 클래스의 함수를 다른 static 클래스의 생성자에서 호출하면 the type initializer for threw an exception등의 원인 파악이 힘든 오류 발생


1. 가능하면 static 클래스/생성자 사용하지 말자
2. 어쩔 수 없이 쓰더라도 수동초기화 하는 정적 클래스의 함수는 호출하지 않기
3. static 생성자는 항상 예외처리하여 vs ouput창에 trace log남기기

'library > .NET' 카테고리의 다른 글

예외처리  (0) 2019.06.27
Panel Resets Scroll Position after Focus is Lost and Regained  (0) 2012.10.06
wcf 프로젝트 설정  (0) 2011.09.05
블로그 이미지

란마12

,

예외처리

library/.NET 2019. 6. 27. 12:31
  1. 꼭 필요한 경우에만 예외를 잡자.
  2. 예외를 연속적으로 던져버리고 싶다면(스택추적정보를 깨뜨리지 않고) throw를 사용하자.
  3. 잡은 예외에 뭔가 더해서 던지고 싶다면 항상 inner exception으로 original exception을 전달하자.
    예) throw new ApplicationException("operation failed!", ex);

'library > .NET' 카테고리의 다른 글

static 클래스 초기화 주의  (0) 2020.08.13
Panel Resets Scroll Position after Focus is Lost and Regained  (0) 2012.10.06
wcf 프로젝트 설정  (0) 2011.09.05
블로그 이미지

란마12

,

public class CustomPanel : System.Windows.Forms.Panel

{

    protected override System.Drawing.Point ScrollToControl(System.Windows.Forms.Control activeControl)

    {

        // Returning the current location prevents the panel from

        // scrolling to the active control when the panel loses and regains focus

        return this.DisplayRectangle.Location;

    }

}



http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/

'library > .NET' 카테고리의 다른 글

static 클래스 초기화 주의  (0) 2020.08.13
예외처리  (0) 2019.06.27
wcf 프로젝트 설정  (0) 2011.09.05
블로그 이미지

란마12

,
1. 참조

System.ServiceModel
System.ServiceModel.Discription
System.Runtime.Serialization

2. 서버

 2.1. 윈도우 서비스일경우
  - 빌드 전 이벤트
     net stop "서비스 이름"
     REM 이미 멈춰있을 경우 오류처리 무시
     IF %errorlevel%==2 exit 0
  - 빌드 후 이벤트
     REM net start "서비스 이름"
     REM 오류처리 무시
     REM IF %errorlevel%==2 exit 0
  - 서비스 설치/제거
     C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe 서비스경로/파일명
     C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe /u 서비스경로/파일명

3. 클라이언트

 3.1. 서비스 참조/업데이트 시 당근 해당서비스가 실행중이어야 함.
 3.2. 대량의 데이터를 받을 경우 binding객체의 MaxReceivedMessageSize, ReaderQuotas.MaxArrayLength 크길를 늘림.

4. 디버깅
 4.1. #if DEBUG
                Debugger.Launch();
       #endif

'library > .NET' 카테고리의 다른 글

static 클래스 초기화 주의  (0) 2020.08.13
예외처리  (0) 2019.06.27
Panel Resets Scroll Position after Focus is Lost and Regained  (0) 2012.10.06
블로그 이미지

란마12

,