简体   繁体   中英

Unhandled exception: An invalid parameter was passed to a function that considers invalid parameters fatal in UWP application

So I was making a polynomial simplifier for my school project. I decided to make the application using C++ UWP in Visual Studio.

As one of the extra features of the application I implemented a system to store and retrieve polynomials from a file so that you can access your previously entered polynomials. I am using boost::filesystem for this. The code compiles fine. But while debugging, this function:

fs::exists(basePath) // namespace fs = boost::filesystem

...is somehow causing the following exception:

Unhandled exception at 0x00007FFBB71AAFEC (ucrtbased.dll) in ExpressionSimplifierV4 UWP.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.

..thrown from this line:

rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); // App.xaml.cpp

My question: What is the cause of this exception and how do I resolve it ?

If any extra information is needed, do tell me... Thanks

When writing UWP applications, be aware that they by design run in a 'locked-down' environment. One aspect of this is that they have very limited access to the file system.

A UWP application by default has:

  • read-only access to its own installed directory (which is typically the 'current working directory' at start-up). This is pointed to by Windows.ApplicationModel.Package.Current.InstalledLocation .

  • read/write access to its own per user application data directory. The non-roaming version is ApplicationData.Current.LocalFolder . The roaming version is ApplicationData.Current.RoamingFolder .

  • read/write access to a per user application temporary directory that may or may not be there on future invocations of the application. This is ApplicationData.Current.TemporaryFolder .

Any attempt to access a file folder other than those above by default will fail .

See Microsoft Docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM