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

disable VisualStudioInstanceProvider on mono #1001

Merged
merged 1 commit into from
Oct 30, 2017

Conversation

corngood
Copy link
Contributor

Since #998 I've been getting:

System.PlatformNotSupportedException: Operation is not supported on this platform.
  at OmniSharp.MSBuild.Discovery.Interop.GetSetupConfiguration () [0x0000a] in <fc86425b83fa4820a94c3447774fdb30>:0
  at OmniSharp.MSBuild.Discovery.Providers.VisualStudioInstanceProvider.GetInstances () [0x0000e] in <fc86425b83fa4820a94c3447774fdb30>:0
  at OmniSharp.MSBuild.Discovery.MSBuildLocator.GetInstances () [0x0001e] in <fc86425b83fa4820a94c3447774fdb30>:0
  at OmniSharp.CompositionHostBuilder.Build () [0x00053] in <fc86425b83fa4820a94c3447774fdb30>:0
  at OmniSharp.Stdio.Host..ctor (System.IO.TextReader input, OmniSharp.Stdio.Services.ISharedTextWriter writer, OmniSharp.IOmniSharpEnvironment environment, Microsoft.Extensions.Configuration.IConfiguration configuration, System.IServiceProvider serviceProvider, OmniSharp.CompositionHostBuilder compositionHostBuilder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, System.Threading.CancellationTokenSource cancellationTokenSource) [0x00052] in <6ba7b54f3edf42509e7ecb6c40595f1f>:0
  at OmniSharp.Stdio.Program+<>c__DisplayClass0_0.<Main>b__1 () [0x00087] in <6ba7b54f3edf42509e7ecb6c40595f1f>:0
  at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.<OnExecute>b__0 () [0x0000b] in <fc86425b83fa4820a94c3447774fdb30>:0
  at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x0035b] in <e56ebbc3ed87488b8e26736bbadaa5d3>:0
  at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable`1[T] args) [0x00042] in <fc86425b83fa4820a94c3447774fdb30>:0
  at OmniSharp.Stdio.Program+<>c__DisplayClass0_1.<Main>b__0 () [0x00028] in <6ba7b54f3edf42509e7ecb6c40595f1f>:0
  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <fc86425b83fa4820a94c3447774fdb30>:0

I've worked around this by disabling the VS instance provider on mono, but I'm still not exactly sure why it's failing. I've tried x64 and x86 mono, and according to http://www.mono-project.com/docs/advanced/com-interop/, COM interop is supposed to work.

@corngood
Copy link
Contributor Author

@DustinCampbell
Copy link
Contributor

DustinCampbell commented Oct 30, 2017

Are you running OmniSharp on Mono on Windows?

(and if so, why?)

@corngood
Copy link
Contributor Author

Yeah, unfortunately. There's a bug somewhere that causes net46 processes to hang when started as a child process from cygwin emacs (nothing ever shows up on stdout). This doesn't happen with earlier runtimes (e.g. 3.5) or mono.

@DustinCampbell
Copy link
Contributor

Got it. That kind of stinks. It'd be great if we could track down that bug. Do you know if it happens with the Windows Linux Subsystem?

@@ -17,7 +17,7 @@ public VisualStudioInstanceProvider(ILoggerFactory loggerFactory)

public override ImmutableArray<MSBuildInstance> GetInstances()
{
if (!PlatformHelper.IsWindows)
if (!PlatformHelper.IsWindows || PlatformHelper.IsMono)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove the first condition?

if (PlatformHelper.IsMono)
{
    return NoInstances;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but I figured that was also there for non-windows non-mono platforms e.g. netcore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OmniSharp does not run on .NET Core. It requires Mono or Desktop CLR. So, that change should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Done.

@corngood
Copy link
Contributor Author

I don't think it's possible to fork/exec a net46 process from WSL. I'm sure running emacs on WSL w/ mono omnisharp would be fine, but I prefer the GUI/filesystem integration in cygwin.

I do plan on investigating the bug, but I have a feeling it's something to do with file handle/tty stuff in .net. I'll at least try to make a simple repro.

@DustinCampbell DustinCampbell merged commit f450e9e into OmniSharp:master Oct 30, 2017
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

Successfully merging this pull request may close these issues.

2 participants