Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exit code 100. Too many semaphores

Tags:

c#

.net

I'm writing a C# program in Visual Studio 2012 and I have a problem. Here's my code fragment:

Process proc = new Process();

proc.StartInfo.Verb = "runas";
proc.StartInfo.FileName = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm.exe";
proc.StartInfo.Arguments = "Absolute\\path\\to\\File.dll /codebase /tlb";
proc.Start();
proc.WaitForExit();

MessageBox.Show("Exit code: "+proc.ExitCode);
proc.Close();

The problem is, when I build a Debug binary and run it, it works just great. Launches regasm.exe, registers the DLL, generates the .tlb file and it's all dandy.

But when I run a Release binary, nothing works and the MessageBox shows me "Exit code: 100". I looked it up but haven't really found anything useful at all.


Found my solution here: http://objectmix.com/dotnet/320921-regasm-tlb-complaints-element-not-found.html

RegAsm.exe error was like this:

RegAsm : error RA0000 : Type library exporter encountered an error while
processing 'Ruby2net.IRuby2net, Ruby2net'. Error: Element not found.

It looks like it was because I accidentally used the same GUID twice in my program. Thank you all for your time.

like image 621
Janis Vepris Avatar asked Feb 06 '14 00:02

Janis Vepris


2 Answers

Lots of Google hits for "regasm exit code 100", just have a look-see.

Regasm will display an error message, you just can't see it because the console window immediately closes. You need to keep it open so you can read the error message. Do so by running cmd.exe with the /k option (keep). Roughly:

        var proc = new System.Diagnostics.Process();

        proc.StartInfo.Verb = "runas";
        proc.StartInfo.FileName = "cmd.exe";
        proc.StartInfo.Arguments = "/k C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\regasm.exe \"Absolute\\path\\to\\File.dll\" /codebase /tlb";
        proc.Start();
like image 167
Hans Passant Avatar answered Oct 19 '22 13:10

Hans Passant


It turns out to be such a stupid mistake, as always...

The problem was that I used the same GUID in two places, a simple error when copying and pasting. Thank you all for your precious time.

like image 44
Janis Vepris Avatar answered Oct 19 '22 13:10

Janis Vepris