Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6164547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:00:44+00:00 2026-05-23T22:00:44+00:00

I created a program that works well on my computer(s) and normally also on

  • 0

I created a program that works well on my computer(s) and normally also on other computers.
However there is one person which is having a problem when run it and I really don’t understand why, the Stacktrace is:

System.Runtime.InteropServices.ExternalException (0x80004005):
Impossibile eseguire un programma. Il comando in esecuzione era
“C:\Windows\Microsoft.NET\Framework64\v4.0.30319\c sc.exe” /noconfig
/fullpaths @”C:\Users\Andry\AppData\Local\Temp\dot0eqxi.cmdli ne”.
—> System.ComponentModel.Win32Exception (0x80004005): Unknown error
(0x36b1) in System.CodeDom.Compiler.Executor.ExecWaitWithCaptu
reUnimpersonated(SafeUserTokenHandle userToken, String cmd, String
currentDir, TempFileCollection tempFiles, String& outputName, String&
errorName, String trueCmdLine) in
System.CodeDom.Compiler.Executor.ExecWaitWithCaptu
re(SafeUserTokenHandle userToken, String cmd, String currentDir,
TempFileCollection tempFiles, String& outputName, String& errorName,
String trueCmdLine) in
Microsoft.CSharp.CSharpCodeGenerator.Compile(Compi lerParameters
options, String compilerDirectory, String compilerExe, String
arguments, String& outputFile, Int32& nativeReturnValue, String
trueArgs) in Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch
(CompilerParameters options, String[] fileNames) in
Microsoft.CSharp.CSharpCodeGenerator.FromSourceBat
ch(CompilerParameters options, String[] sources) in
Microsoft.CSharp.CSharpCodeGenerator.System.CodeDo
m.Compiler.ICodeCompiler.CompileAssemblyFromSource
Batch(CompilerParameters options, String[] sources) in
System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns,
XmlSerializerCompilerParameters xmlParameters, Evidence evidence) in
System.Xml.Serialization.TempAssembly.GenerateAsse mbly(XmlMapping[]
xmlMappings, Type[] types, String defaultNamespace, Evidence evidence,
XmlSerializerCompilerParameters parameters, Assembly assembly,
Hashtable assemblies) in
System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings,
Type[] types, String defaultNamespace, String location, Evidence
evidence) in System.Xml.Serialization.XmlSerializer..ctor(Type type,
String defaultNamespace) in SpellCaster3.Program.LoadBaseRange() in
SpellCaster3.Program.Main()

As you can see the problem is connected with deserialization (that object is only deserialized) and it happens in XmlSerializer constructor.

The problem may be connected in some way with this question: Why is my windows service launching instances of csc.exe? and Why is my windows service launching instances of csc.exe?

I obviusly can’t replicate the bug.
Here is the code involved:

Program.cs

    private static void LoadBaseRange()
    {
        string fileIconImageIndices = Application.StartupPath + Path.DirectorySeparatorChar + "ValidIconImageIndices.xml";
        if (!File.Exists(fileIconImageIndices)) throw new FileNotFoundException("Attenzione, il file degli indici delle immagini non è stato trovato");

        using (StreamReader reader = new StreamReader(fileIconImageIndices, Encoding.UTF8))
        {
            XmlSerializer serializer = new XmlSerializer(typeof(RangeCollection));
            Forms.GumpPicker.BaseRange = serializer.Deserialize(reader) as RangeCollection;
        }
    }

    /// <summary>
    /// Punto di ingresso principale dell'applicazione.
    /// </summary>
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
        try
        {
            LoadBaseRange();
        }
        catch (FileNotFoundException fileException)
        {
            ErrorForm.Show(fileException.Message + "\nL'applicazione verrà terminata", fileException);
            return;
        }
        catch (Exception exception)
        {
            ErrorForm.Show("L'applicazione verrà terminata", exception);
            return;
        }

RangeCollection.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace Expand.Linq
{
    public class RangeCollection : IXmlSerializable
    {
        public static readonly Version Version = new Version(1, 0, 0, 0);

        internal static Version FoundVersion { get; private set; }

        /// <summary>
        /// Used for xml deserialization
        /// </summary>
        public RangeCollection() { }

        public RangeCollection(IEnumerable<IEnumerable<int>> ranges)
        {
            Range = ConvertToListInt(ranges);
        }

        private List<int> ConvertToListInt(IEnumerable<IEnumerable<int>> ranges)
        {
            IEnumerable<int> tmpRange;
            tmpRange = Enumerable.Empty<int>();

            foreach (IEnumerable<int> range in ranges)
                tmpRange = tmpRange.Union(range);

            tmpRange = tmpRange.OrderBy(number => number);
            return new List<int>(tmpRange);
        }


        public static implicit operator RangeCollection(List<IEnumerable<int>> ranges)
        {
            return new RangeCollection(ranges);
        }

        public List<int> Range { get; private set; }

        public int Maximum
        {
            get
            {
                return Range.Max();
            }
        }

        public int Minimum
        {
            get
            {
                return Range.Min();
            }
        }

        public System.Xml.Schema.XmlSchema GetSchema()
        {
            return null;
        }

        public void ReadXml(System.Xml.XmlReader reader)
        {
            List<IEnumerable<int>> ranges = new List<IEnumerable<int>>(100);
            string elementName = "Range";
            Version version;

            version = Version.Parse(reader.GetAttribute("Version"));
            FoundVersion = version;

            if (reader.IsEmptyElement) return;

            reader.ReadStartElement(GetType().Name);
            while (true)
            {
                if (reader.NodeType == XmlNodeType.Element && reader.LocalName == elementName)
                {
                    reader.ReadStartElement(elementName);
                    int start = reader.ReadElementContentAsInt();
                    int end = reader.ReadElementContentAsInt();
                    reader.ReadEndElement();
                    if (start == end)
                        ranges.Add(ExEnumerable.Range(start));
                    else
                        ranges.Add(ExEnumerable.RangeBetween(start, end));
                }
                else
                    break;
            }
            reader.ReadEndElement();
            Range = ConvertToListInt(ranges);
        }

        public void WriteXml(System.Xml.XmlWriter writer)
        {
            throw new NotSupportedException();
        }
    }
}

ValidIconImageIndices.xml (XML File involved)

<?xml version="1.0" encoding="utf-8" ?>
<RangeCollection Version="1.0.0.0">
  <Range>
    <Start>1236</Start>
    <End>1246</End>
  </Range>
  <Range>
    <Start>1260</Start>
    <End>1260</End>
  </Range>
  <Range>
    <Start>1263</Start>
    <End>1287</End>
  </Range>
  <Range>
    <Start>1300</Start>
    <End>1309</End>
  </Range>
  <Range>
    <Start>1311</Start>
    <End>1312</End>
  </Range>
  <Range>
    <Start>1401</Start>
    <End>1415</End>
  </Range>
  <Range>
    <Start>1782</Start>
    <End>1782</End>
  </Range>
  <Range>
    <Start>1789</Start>
    <End>1795</End>
  </Range>
  <Range>
    <Start>2240</Start>
    <End>2303</End>
  </Range>
  <Range>
    <Start>2406</Start>
    <End>2408</End>
  </Range>
  <Range>
    <Start>2410</Start>
    <End>2419</End>
  </Range>
  <Range>
    <Start>20480</Start>
    <End>20496</End>
  </Range>
  <Range>
    <Start>20736</Start>
    <End>20745</End>
  </Range>
  <Range>
    <Start>20992</Start>
    <End>21020</End>
  </Range>
  <Range>
    <Start>21248</Start>
    <End>21248</End>
  </Range>
  <Range>
    <Start>21251</Start>
    <End>21257</End>
  </Range>
  <Range>
    <Start>21280</Start>
    <End>21287</End>
  </Range>
  <Range>
    <Start>21504</Start>
    <End>21507</End>
  </Range>
  <Range>
    <Start>21536</Start>
    <End>21542</End>
  </Range>
  <Range>
    <Start>21632</Start>
    <End>21632</End>
  </Range>
  <Range>
    <Start>23000</Start>
    <End>23015</End>
  </Range>
</RangeCollection>

I don’t know the O.S. of the user but I think it’s Windows 7 home 64 bit.
He has .NET 4.0 and the application is a Winforms application for .net 4.0

Link to the application if you want test it:
http://dl.dropbox.com/u/762638/Files/Documents/My%20Programs/SpellCaster3/SpellCaster3.zip

Link with installer:
http://dl.dropbox.com/u/762638/Files/Documents/My%20Programs/SpellCaster3/setup.zip

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:00:45+00:00Added an answer on May 23, 2026 at 10:00 pm

    The C# compiler (csc.exe) cannot get started on that machine. The error code is miserable, E_FAIL which doesn’t mean anything more than “it didn’t work, don’t know why”. The C# compiler is needed here in order to generate the XML serialization assembly.

    This is an environmental problem, it has nothing to do with your code. Given the lousy error code, it could be anything. Malware scanners usually leads the pack in causes for trouble like that. This is a problem that the user’s IT team needs to solve, there is very little that you can do about it. Although you could use sgen.exe to pre-generate the serialization assembly up front so that it doesn’t have to be done on the user’s machine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I bought this program that created a pretty nice imageuploader flash script however I
I created one GWT webapplication project.Inthat i want to create servlet program,but in that
I'm trying to make a program in Visual C# that has my one created
I created a method that works Just Well Enough (takes ~4 seconds to complete)
I am developing a program which sends images from one computer to another (similar
I have two computers. One computer is an old XP and the other is
I created a program that more or less holds an array of strings as
I've created a program that creates and populates a custom document property in an
I created a server program that will be started as root. After it is
I've created a program in Delphi that uses Google's AJAX Search API to evaluate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.