Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. This is weird!!!

This is weird!!!

Scheduled Pinned Locked Moved C#
sysadmincryptography
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kingletas
    wrote on last edited by
    #1

    Why am i getting this exception... System.TypeInitializationException was unhandled Message="The type initializer for 'Client.Form1' threw an exception." Source="Client" TypeName="Client.Form1" StackTrace: at Client.Form1..ctor() at Client.Program.Main() in C:\Documents and Settings\Luis\Desktop\Server\Client\Client\Program.cs:line 21 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() I added this code to it.... In a different class from the main form i have this: // the try and catch were there already try{....}// see the finally statement for more info catch(....){....}// i just warned that all files in the given file will be deleted //this is the newly added code finally { //path points to a given folder,specify by the Administrator during runtime // foreach(string npath in Dfiles) { File.Delete(npath); } string[] files = Directory.GetFiles(@"C:\Backup", "*.lais"); foreach (string npath in files) { File.Copy(npath, path, true); } //this is the same i have in the try statement Dfiles = Directory.GetFiles(@path,".lais");//just to make sure i have all the files now... if(Dfiles>0){ foreach (string npath in Dfiles) { tempor = File.ReadAllBytes(Dfiles[i]); ms = new MemoryStream(tempor, 0, tempor.Length); crypto = new CryptoStream(ms, Algorythm.CreateDecryptor(), CryptoStreamMode.Read); crypto.Read(tempor, 0, tempor.Length); Images[i] = Image.FromStream(ms); crypto.Close();

    M 1 Reply Last reply
    0
    • K kingletas

      Why am i getting this exception... System.TypeInitializationException was unhandled Message="The type initializer for 'Client.Form1' threw an exception." Source="Client" TypeName="Client.Form1" StackTrace: at Client.Form1..ctor() at Client.Program.Main() in C:\Documents and Settings\Luis\Desktop\Server\Client\Client\Program.cs:line 21 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() I added this code to it.... In a different class from the main form i have this: // the try and catch were there already try{....}// see the finally statement for more info catch(....){....}// i just warned that all files in the given file will be deleted //this is the newly added code finally { //path points to a given folder,specify by the Administrator during runtime // foreach(string npath in Dfiles) { File.Delete(npath); } string[] files = Directory.GetFiles(@"C:\Backup", "*.lais"); foreach (string npath in files) { File.Copy(npath, path, true); } //this is the same i have in the try statement Dfiles = Directory.GetFiles(@path,".lais");//just to make sure i have all the files now... if(Dfiles>0){ foreach (string npath in Dfiles) { tempor = File.ReadAllBytes(Dfiles[i]); ms = new MemoryStream(tempor, 0, tempor.Length); crypto = new CryptoStream(ms, Algorythm.CreateDecryptor(), CryptoStreamMode.Read); crypto.Read(tempor, 0, tempor.Length); Images[i] = Image.FromStream(ms); crypto.Close();

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! The exception tells you that the type Client.Form1 could not be initialized correctly, i.e. either the static type initializer (if you have one) or the initialization of a static member threw an exception.

      Regards, mav -- Black holes are the places where God divided by 0...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups