导航到另一个 Class 图书馆的页面
Navigate to a Page of another Class Library
我需要创建一个核心项目的多个版本。核心项目及其扩展、一些功能以及最重要的设计(字体、颜色等)之间几乎没有什么可以改变的。为此,我创建了一个 Class Library
。几天前我提出了一个问题,我猜想创建 Class Library
是正确的方法。这里有一个 link 到 post。
现在我在库中有了所有项目,我正在创建这些扩展,我想导航到 Class Library
的页面,但是从扩展中我得到了这个异常:
Exception thrown: 'System.AccessViolationException' in MyProject.exe
Additional information: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.
class 库包含 UserControls
和 Pages
,但我不确定这是否是最好的解决方法。所以任何建议或教程将不胜感激。
谢谢!
幸运的是,Daniel Vaughan (http://danielvaughan.org/post/UWP-AccessViolationException-when-Navigating-to-a-Page-in-Another-Assembly.aspx) 提出了一个解决方法:
- 在启动项目中创建一个Dummy.xaml
halllo 的回答只适用于调试版本中的我。当我 build/deploy 在 Release 构建时,问题仍然存在。相反,我只是删除导航代码并直接分配内容。到目前为止我的应用程序运行良好(因为我不需要导航,它是一个单一的 WebView 应用程序)但我不知道是否会有任何问题。
// rootFrame.Navigate(typeof(MainPage), e.Arguments);
// Remove the above default line
// MainPage is a C# class that inherits a Page in my library
rootFrame.Content = new MainPage();
我需要创建一个核心项目的多个版本。核心项目及其扩展、一些功能以及最重要的设计(字体、颜色等)之间几乎没有什么可以改变的。为此,我创建了一个 Class Library
。几天前我提出了一个问题,我猜想创建 Class Library
是正确的方法。这里有一个 link 到 post。
现在我在库中有了所有项目,我正在创建这些扩展,我想导航到 Class Library
的页面,但是从扩展中我得到了这个异常:
Exception thrown: 'System.AccessViolationException' in MyProject.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
class 库包含 UserControls
和 Pages
,但我不确定这是否是最好的解决方法。所以任何建议或教程将不胜感激。
谢谢!
幸运的是,Daniel Vaughan (http://danielvaughan.org/post/UWP-AccessViolationException-when-Navigating-to-a-Page-in-Another-Assembly.aspx) 提出了一个解决方法:
- 在启动项目中创建一个Dummy.xaml
halllo 的回答只适用于调试版本中的我。当我 build/deploy 在 Release 构建时,问题仍然存在。相反,我只是删除导航代码并直接分配内容。到目前为止我的应用程序运行良好(因为我不需要导航,它是一个单一的 WebView 应用程序)但我不知道是否会有任何问题。
// rootFrame.Navigate(typeof(MainPage), e.Arguments);
// Remove the above default line
// MainPage is a C# class that inherits a Page in my library
rootFrame.Content = new MainPage();