简体   繁体   中英

WPF application runs on my machine but nobody elses

Issue


This issue has only just started happening but its stopping other people installing the application and running it.

I am able to run the application on my VS2015 and also i can install the application on my machine and run it. When another uses installs the application nothing loads up and they get an EventLog:

Fault bucket 129060628035, type 5
Event Name: CLR20r3
Response: Not available
Cab Id: 0

Problem signature:
P1: Podia2016.exe
P2: 1.0.0.0
P3: 56fe6f19
P4: System
P5: 4.6.1038.0
P6: 5615c2d1
P7: 2d06
P8: 11b
P9: System.Security.Security
P10: 

Recently as well the application has been getting notifications when installing that it could be a harmful program and i have to allow it. Like i said, this has only just recently happened and it causes all types of issues.

Code


The only things i can think of that can cause this is I have to Read and Write to the users registry ( Writing ):

RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);

key.CreateSubKey("Podia2016");
key = key.OpenSubKey("Podia2016", true);

key.CreateSubKey("v1");
key = key.OpenSubKey("v1", true);

key.SetValue("URL", serverURL);
key.SetValue("UID", username);
key.SetValue("PWD", password);

I also Read the registry:

RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", RegistryKeyPermissionCheck.ReadSubTree, System.Security.AccessControl.RegistryRights.ReadKey);
key = key.OpenSubKey("Podia2016", RegistryKeyPermissionCheck.ReadSubTree, System.Security.AccessControl.RegistryRights.ReadKey);
key = key.OpenSubKey("v1", RegistryKeyPermissionCheck.ReadSubTree, System.Security.AccessControl.RegistryRights.ReadKey);

I really don't know how I can actually find out what is the problem with my application. Any help or ideas would be great!

EDIT:

I have just commented out everything on my login page and the page appeared successfully leading my to believe that either the application does not have access to Write to the EventLog, it is not able to Read/Write from the registry or that it does have access to create a file.

If i run my application as Admin this does not help.

You can add an exception handler in your MainWindow.cs file and check the exception object you get.

public MainWindow()
{
    AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
    Windows.Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
}


void Current_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
}

void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
}

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