다른 질문을 살펴 보았지만 적용되는 것 중 아무 것도 없습니다. 이것은 Windows 7 64Bit 시스템에서 실행되는 VS2010입니다.지정된 캐스트가 런타임에는 유효하지만 디버거에서는 유효하지 않습니다.
최근 몇 달 동안 정상적으로 실행되는 양식에 코드를 추가했습니다. activate 이벤트를 약간 변경했습니다. 갑자기 런타임에 예외가 발생하기 시작했습니다. 디버거에는 없습니다. JIT 런타임 디버거 (예 : system.windows.forms jitDebugging = "true")를 설정하면 오류도 사라집니다 (VS2010이 설치되어 있기 때문에 제 개발 컴퓨터에서 추측하고 있지만 클라이언트의 컴퓨터에서는 그렇지 않습니다)
물론 내 코드 (주석 처리하지 않음)를 취소했지만 오류 메시지가 그대로 유지됩니다. 디버거에서 예외를 throw하지 않기 때문에 어디에 문제가 있는지 알 수 없습니다.
공용 언어 런타임 예외를 설정하려고 시도했지만 오류가 표시되지 않습니다.
디버그 라인을 넣은 다음 파일로 보냈습니다. Activate 이벤트가 호출되었지만 표시된 이벤트가 예외가 throw되기 전에 호출 된 것 같지 않습니다. 지금 보여지는 것을 제외하고는 아무 것도 정의되지 않은 메소드가 있지만 예외가 발생하기 전에 디버그 쓰기가 파일에 저장되지 않으므로 해당 메소드에 문제가있는 경우에는 아무 것도 모른다. 도시
전체 오류는 다음과 같습니다
System.InvalidCastException: Specified cast is not valid.
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.StringSource..ctor(String[] strings)
at System.Windows.Forms.TextBox.SetAutoComplete(Boolean reset)
at System.Windows.Forms.TextBox.OnHandleCreated(EventArgs e)
at System.Windows.Forms.Control.WmCreate(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[편집] 표시된 방법 : 내가 HVD의 코멘트 @ 여기에 붙여
int shownHeight = -1;
int shownTop = -1;
int ButtonOneTop = -1;
int MagnifiedPanelTop = -1;
int MagnifiedPanelHeight = -1;
int SelectedStateTop = -1;
private void VoiceCommandInput_Shown(object sender, EventArgs e)
{
_ThisForm = this;
VoiceTextbox.CharacterCasing = CharacterCasing.Upper; ;
voiceCommandButton.Focus();
_ThisForm.Height = MagnifiedPanel.Height + 38;
keyboardPanel.Top = MagnifiedPanel.Bottom + 2;
int chkptone = button1.Top;
shownHeight = _ThisForm.Height;
_ThisForm.Height = shownHeight + AdvancedButtonsPanel.Height + 10;
shownTop = _ThisForm.Top;
ButtonOneTop = chkptone;
MagnifiedPanelTop = MagnifiedPanel.Top;
MagnifiedPanelHeight = MagnifiedPanel.Height;
SelectedStateTop = selectedState.Top;
AdvancedButtonsPanel.Top = selectedState.Bottom + 20;
AdvancedButtonsPanel.Visible = true;
AdvancedButtonsPanel.BringToFront();
keyboardPanel.Top = AdvancedButtonsPanel.Bottom + 20;
BKD_buttonPusher.WorkerReportsProgress = true;
BKD_buttonPusher.WorkerSupportsCancellation = true;
BKD_buttonPusher.DoWork += new DoWorkEventHandler(this.buttonPusher_DoWork);
BKD_buttonPusher.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.buttonPusher_RunWorkerCompleted);
VoiceTextbox.Focus();
}
코드를 공유하십시오. – bjan
공유 할 코드가 확실하지 않습니다 ...? 문제가있는 곳을 잘 모르겠습니다. 전체 양식? 전체 표시 방법? 무엇을 공유해야합니까? – MarkJoel60
'UnsafeNativeMethods.CoCreateInstance'는 C#이 아닌 코드와 관련이 있음을 나타냅니다. 일부 DLL/COM 구성 요소/-.net 코드가 호출되고 있습니다. 코드의 사본을 만들고 비 예외 생성 코드를 모두 주석 처리하고 문제 영역을 좁 힙니다. – bjan