나는 다중 프로젝트 응용 프로그램이 있습니다. 시작 프로젝트에서 Application_Startup을 호출하는 것보다 현재 (거의 현재) 더 있습니다. xaml은 다음과 같이 정의됩니다.내 wpf 응용 프로그램이 이미 사용하고있는 리소스를 찾지 못하게하는 이유
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Application_Startup">
<Application.Resources>
</Application.Resources>
</Application>
이며 application_startup 이벤트 자체는 다음과 같이 정의됩니다.
Private Sub Application_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
Dim controller As New LoginController(New LoginService)
_CanLaunchMainApplication = controller.StartLoginDialog
If _CanLaunchMainApplication Then
Else
Application.Current.Shutdown
End If
End Sub
응용 프로그램을 시작할 때 로그인 대화 상자가 표시되며 현재 false가 반환됩니다. 내가 도달 한 if 문의 Application.Current.Shutdown 행에 중단 점을 설정했습니다. 계속 누르면 응용 프로그램이 종료 될 것으로 예상되지만 IOException 유형의 처리되지 않은 예외가 throw됩니다. 'appplication_startup'리소스를 찾을 수 없다는 메시지가 나타납니다. 코드 실행
왜 이런 일이 일어날 지 설명 할 수 있습니까?
편집
다음은 관련 스택 추적입니다.
at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream()
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
XAML에 정의 된 리소스가 표시되지 않습니다. 또는 코드. StartupUri는 리소스의 이름이 아니며 메서드의 이름입니다. 예외는 어디에서 발생합니까? 스택 추적은 무엇입니까? 어디서나'application_startup'이라는 이름의 리소스를 만들거나 액세스하려고합니까? 관련 코드를 게시하십시오 –
원래 질문에 StackTrace가 추가되었습니다. –
StartupUri은 응용 프로그램의 기본 창 클래스와 같은 리소스를 가리켜 야합니다. 대신 이벤트 핸들러 메서드의 이름을 지정합니다. –