Unity UWP File IO denies access to Desktop and more? - c#

I created a blank Unity project, built it for UWP and added one line of code:
File.ReadAllText(#"C:\\Users\jtth\Desktop\cntrlRcrds-013.txt");
And I get back,
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.ni.dll
Additional information: Access to the path 'C:\Users\jtth\Desktop\cntrlRcrds-013.txt' is denied.
I have:
Checking Firewall
Made sure all folders/files in path weren't Read Only
Changed path to root C:\
Tried path into the Apps data folder
Ran Unity & VS as admin
Restarted my computer
What gives? Please advise.
NOTE: I am running this on 'Local Machine', not on the HoloLens. The HoloLens has a variety of access permission issues itself.

UWP is very sandboxed, you can't really access most folders or files through the application...
Try
File.ReadAllText(System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "cntrlRcrds-013.txt"));
And put the file in the location that Windows.Storage.ApplicationData.Current.LocalFolder.Path points to.
Hope this helps.

Related

Unable to connect mainframe server from x3270if code

Trying to connect mainframe using console app provided here, getting below error in the trace.
SSL DLL init failed: Cannot load ssleay32.dll
Tried copying ssleay32.dll in bin folder but still getting the issue.
Please help me with this.
I am using a windows machine
Assuming your operating environment is Linux. Make sure the LD_LIBRARY_PATH includes the location of the dll you are loading.
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:x3270ifInstallDir/bin
Replacing x3270ifInstallDir/bin with where your dll is located

WebKit.NET with C# Project Runtime Exception

I have downloaded WebKit.NET 0.5-bin-cairo to work with an existing C# Project. I've included WebKitBrowser.dll and WebKit.Interop.dll as a reference to the module that requires it, as well as playing them directly in the debug/bin folder as directly by this tutorial.
I do not get any errors until I run the project and get an exception on this line in InitializeComponent() of the designer class.
this.webKitBrowser1 = new WebKit.WebKitBrowser();
The exception:
An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in WebKitBrowser.dll
Additional information: Failed to initialize activation context
I am building all the modules as 86x debug and my computer is 64 bit.
Any suggestions are appreciated as I've been playing around with this for multiple days.
I had encountered same issue. Three things were missing in my scenario.
manifest files: must be placed as all dlls are dynamically linked
VC++ must be installed on machine: In my case I used vc++2005 redistributable sp1.
Not only dlls/pdb/manifest you need to copy all the folders to root directory of executable
There is no correct packaging available yet for all files/folders of webkit.NET
And obviously project architecture should be x86 for all projects referencing webkit dlls
Have you tried:
WebKit.Net and OpenWebKitSharp Error: Failed to initialize activation context ? Namely to copy all the files from Core(not just the dlls) into your project /bin/release/ or /bin/debug/ folder?
quoted from the tutorial you followed:
Before we can run the application, WebKit.dll and it's dependencies must be present in the output directory. In Windows Explorer (or otherwise), copy all of the files from the WebKit .NET 'bin' directory to your project's output directory. For example, here is the listing of my output directory after copying:
D:\webkitdotnet\WebKitTest\WebKitTest\bin\Debug>ls
CFLite.dll icudt40.dll
JavaScriptCore.dll icuin40.dll
JavaScriptCore.resources icuuc40.dll
SQLite3.dll libcurl.dll
WebKit.Interop.dll libcurl.dll.manifest
WebKit.dll libeay32.dll
WebKit.resources libeay32.dll.manifest
WebKitBrowser.dll libpng13.dll
WebKitBrowser.dll.manifest libxml2.dll
WebKitBrowser.pdb libxslt.dll
WebKitTest.exe pthreadVC2.dll
WebKitTest.pdb ssleay32.dll
WebKitTest.vshost.exe ssleay32.dll.manifest
WebKitTest.vshost.exe.manifest zlib1.dll
curl.exe.manifest
You mentioned you only copied WebKitBrowser.dll and WebKit.Interop.dll over

Error in ReportViewer after deploy ClickOnce - HRESULT: 0x80131401

I hope that will help me with this issue.
I have a problem with a application (winforms) build with .net framework 4.5 and ReportViewer 11 (Reporv Viewer 2012). Ago few weeks I deploy using Windows Azure and install to clients, but when i run a report show me an exception.
**An error occurred during local report processing.
Failed to load expression host assembly. Details: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)**
When I deploy in network (LAN) was working fine, but when I deploy via internet i get this error, this error only occurs when i start the application via shortcut .appref-ms, but if I start application executing .exe file show report correctly.
Some else have this problem and how solve?
Thanks.
I found my problem.
I solve this only comment this line, because i dont use ngen ;).
i just comment attribute [LoaderOptimization(LoaderOptimization.MultiDomainHost)] in Main method. This works fine for me, check if you have and comment ;).

MonoGame not working

I am just getting started with MonoGame (and game programming in general) and cant run any programs. I keep getting this exception message
An unhandled exception of type 'System.DllNotFoundException' occurred in MonoGame.Framework.dll
Additional information: Unable to load DLL 'openal32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Does anybody know how I can fix this?
You'll need to install OpenAL.
This is included in the standard MonoGame installer, and placed in "C:\Program Files (x86)\MonoGame\v3.0\oalinst.exe".
Yes, you need to install OpenAL. If you're bulding windows game project it will be wise to add OpenAL DLL file links into your project and mark them to be copied to Output directory. This way your deployed game will not require separate OpenAL installation on client (or even on another dev machine).
Dll files are:
OpenAL32.dll
wrap_oal.dll
I had the same error, when you have win10 it includes directX, so if you are using win 8 or less you need to install direct10: the link: https://www.microsoft.com/en-us/download/details.aspx?id=35&nowin10
and.... finally works!!!

.net 3.5 c# works locally but not when I publish to shared account

I am new to .NET and have a problem. I have an app that creates a security token to use remote web services. When I run the app locally on my machine it works fine (in the Visual Web Developer Express 2008). I then took a shared hosting Windows account on godaddy.com. When I publish the site and then check online, I get the error:
Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
`
Any suggestions where I can check for the problem? Is it my app? A limitation of godaddy?
Thanks!
Basically what is happening is that your application is trying to write to the file system and it is getting a permissions error due to not being granted permissions. There are a few things for you to do.
Confirm exactly where you are writing the file to. On a shared account, you should ONLY be writing to folders within your path and not trying to use any temporary location.
After doing #1, contact GoDaddy to figure out why you don't have permissions to write to the needed directory.
Try using Server.MapPath to get a place to locate your files. If you hardcoded something like "c:\tempdir\website1\tempfile.txt" this won't work because it's shared hosting on GoDaddy.
The Server.MapPath method returns a dynamic file path based on where your root files are located. You should have read/write access to you're root directory on GoDaddy.

Categories