Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime crash and compile error with Mono on Mac #1

Open
knut-forkalsrud opened this issue Dec 6, 2017 · 2 comments
Open

Runtime crash and compile error with Mono on Mac #1

knut-forkalsrud opened this issue Dec 6, 2017 · 2 comments

Comments

@knut-forkalsrud
Copy link

This may be a challenging starting point, as I am not a C Sharp programmer. Nor do I have a Windows machine to run this on. My environment is Mono (version 5.0.1.1) on a Mac (macos 10.11.6).

Let me first set the stage for how I get to the problem at hand. I have a repository with way too many merge commits, and when I want to split out parts of the repository I use git filter-branch with --prune-empty only to find that I'm left with about 20 merge commits for every commit with actual changes. So I started looking around, and found this project. Thanks for publishing, it seems this is the only project trying to deal with such issues. Much appreciated.

Now for the problem. I download the release and try to run it:
mono /path/to/Firebolt.exe --prune-empty-merges master
Only to get an error:

The following options were not recognized and will be passed to git:
master
Finding refs to rewrite... 1 (refs/heads/master)
Listing commits to rewrite...30722
Rewriting...
* Assertion at mono-error.c:761, condition `!is_boxed ((MonoErrorInternal*)target_error)' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Threading.ThreadPool.PostQueuedCompletionStatus (System.Threading.NativeOverlapped*) [0x00000] in <acc111defcae454692c163a6e6c82ede>:0
  at System.Threading.ThreadPool.UnsafeQueueNativeOverlapped (System.Threading.NativeOverlapped*) [0x00000] in <acc111defcae454692c163a6e6c82ede>:0
  at System.Threading.Tasks.Schedulers.IOTaskScheduler.QueueTask (System.Threading.Tasks.Task) [0x00029] in <b2e515a4d05f4a45aaeca61828e43758>:0
  at System.Threading.Tasks.TaskScheduler.InternalQueueTask (System.Threading.Tasks.Task) [0x00008] in <acc111defcae454692c163a6e6c82ede>:0
  at System.Threading.Tasks.Task.ScheduleAndStart (bool) [0x00073] in <acc111defcae454692c163a6e6c82ede>:0
  at System.Threading.Tasks.Task`1<TResult_REF>.StartNew (System.Threading.Tasks.Task,System.Func`1<TResult_REF>,System.Threading.CancellationToken,System.Threading.Tasks.TaskCreationOptions,System.Threading.Tasks.InternalTaskOptions,System.Threading.Tasks.TaskScheduler,System.Threading.StackCrawlMark&) [0x00051] in <acc111defcae454692c163a6e6c82ede>:0
  at System.Threading.Tasks.TaskFactory.StartNew<TResult_REF> (System.Func`1<TResult_REF>,System.Threading.CancellationToken,System.Threading.Tasks.TaskCreationOptions,System.Threading.Tasks.TaskScheduler) [0x00008] in <acc111defcae454692c163a6e6c82ede>:0
  at Firebolt.Core.RewriteEngine.<Run>b__18_1 (string) [0x00019] in <1be3e7a5d27a4dedaf05dd105c745d59>:0
  at System.Linq.Enumerable.ToDictionary<TSource_REF, TKey_REF, TElement_REF> (System.Collections.Generic.IEnumerable`1<TSource_REF>,System.Func`2<TSource_REF, TKey_REF>,System.Func`2<TSource_REF, TElement_REF>,System.Collections.Generic.IEqualityComparer`1<TKey_REF>) [0x00096] in <17b7ffded61b41618934d7c7b93897b2>:0
  at System.Linq.Enumerable.ToDictionary<TSource_REF, TKey_REF, TElement_REF> (System.Collections.Generic.IEnumerable`1<TSource_REF>,System.Func`2<TSource_REF, TKey_REF>,System.Func`2<TSource_REF, TElement_REF>) [0x00000] in <17b7ffded61b41618934d7c7b93897b2>:0
  at Firebolt.Core.RewriteEngine/<Run>d__18.MoveNext () [0x00020] in <1be3e7a5d27a4dedaf05dd105c745d59>:0
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.Collections.Generic.Dictionary`2<string, LibGit2Sharp.Commit>>.Start<Firebolt.Core.RewriteEngine/<Run>d__18> (Firebolt.Core.RewriteEngine/<Run>d__18&) [0x0002c] in <acc111defcae454692c163a6e6c82ede>:0
  at Firebolt.Core.RewriteEngine.Run (System.Collections.Generic.IEnumerable`1<string>) [0x0002b] in <1be3e7a5d27a4dedaf05dd105c745d59>:0
  at Firebolt.Firebolt.rewrite (System.Collections.Generic.ISet`1<string>,Firebolt.Core.Filters) [0x00038] in <8c3be459807c46a5a6050e2e887ba69f>:0
  at Firebolt.Firebolt.Run () [0x00189] in <8c3be459807c46a5a6050e2e887ba69f>:0
  at Firebolt.Program.Run (string[]) [0x0029a] in <8c3be459807c46a5a6050e2e887ba69f>:0
  at Firebolt.Program.Main (string[]) [0x00000] in <8c3be459807c46a5a6050e2e887ba69f>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x0004e] in <8c3be459807c46a5a6050e2e887ba69f>:0

So I figure, perhaps I can build this myself, get into the nuances of C Sharp and perhaps being able to contribute a fix. However when I try to compile the code with the Mono compiler (version 5.0.1.1) I get compile issues:

cd Firebolt.Core/
mcs *.cs
Extensions.cs(63,53): error CS1644: Feature `declaration expression' cannot be used because it is not part of the C# 6.0 language specification
Compilation failed: 1 error(s), 0 warnings

So, I'm at a loss. Anyhow I figured before I abandon the attempt at least I should file this ticket.

@Xcelled
Copy link
Owner

Xcelled commented Dec 6, 2017

I believe I've run into this myself. It turns out that one of the threadpool schedulers I use as a performance enhancement doesn't work on non-Windows systems due to OS differences. You should be able to bypass that particular optimization by changing line https://github.com/Xcelled/firebolt/blob/master/Firebolt.Core/RewriteEngine.cs#L22 to read = System.Threading.Tasks.TaskScheduler.Default. That will make Firebolt use the mono-provided scheduler instead. If the error goes away... all good!

As for compiling, you need to enable C# 7.0 support on the mono compiler. It actually looks like the latest mono compiler has some C# 7 support builtin - my suggestion is to upgrade mcs if you can.

@Xcelled
Copy link
Owner

Xcelled commented Dec 6, 2017

Actually on closer inspection, mono C#7 doesn't include that particular language feature yet. You can check here for details on C# 7: travis-ci/travis-ci#7477. At the worst, you can edit the code and revert to C# 6 constructs. All the features are just syntactic sugar so you won't lose anything. There aren't many places where C#7 is used.

The specific one it's complaining about is code that looks like this: DoSomething(out int foo);. In C#6 it would be this: int foo; DoSomething(out foo);. I'll try to patch those out at some point, but this should get you started!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants