Question

In the event log i am getting following line, could someone please help me for this.

Event Type: Error
Event Source:   .NET Runtime
Event Category: None
Event ID:   1026
Date:       01/06/2013
Time:       11:20:06
User:       N/A
Computer:   BISO
Description:
Application: TMS.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Security.SecurityException

Stack:    at System.ThrowHelper.ThrowSecurityException(System.ExceptionResource)
at Microsoft.Win32.RegistryKey.InternalOpenSubKey(System.String, Microsoft.Win32.RegistryKeyPermissionCheck, Int32)
at Microsoft.Win32.RegistryKey.OpenSubKey(System.String, Microsoft.Win32.RegistryKeyPermissionCheck, System.Security.AccessControl.RegistryRights)
at System.TimeZoneInfo.CheckDaylightSavingTimeDisabledDownlevel()
at System.TimeZoneInfo.TryCompareTimeZoneInformationToRegistry(TimeZoneInformation, System.String, Boolean ByRef)
at System.TimeZoneInfo.FindIdFromTimeZoneInformation(TimeZoneInformation, Boolean ByRef)
at System.TimeZoneInfo.GetLocalTimeZone()    
at System.TimeZoneInfo.get_Local()
at System.DateTime.ToLocalTime()
at System.DateTime.FromFileTime(Int64)
at System.Timers.ElapsedEventArgs..ctor(Int32, Int32)
at System.Timers.Timer.MyTimerCallback(System.Object)
at System.Threading._TimerCallback.TimerCallback_Context(System.Object)
at System.Threading.ExecutionContext.runTryCode(System.Object)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading._TimerCallback.PerformTimerCallback(System.Object)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Was it helpful?

Solution

You have 2 problems I can see.

  1. When you run it on your own machine, the account which the application is running as has permission to access the registry, however you are missing this permission on the other machine. When you run it on the other machine, can you try run it as Administrator or with escalated privileges ?

  2. You don't have adequate exception handling in your codes Timer_Elapsed method to try/catch and handle the exception so it's crashing the entire application.

Also check if there's any anti-virus /security software running on the other machine which might be sandboxing the app or blocking access to the registry

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top