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

From time "StackOverflowException" while trying to load project #914

Closed
matthid opened this issue Sep 4, 2018 · 13 comments
Closed

From time "StackOverflowException" while trying to load project #914

matthid opened this issue Sep 4, 2018 · 13 comments
Labels
bug language services Problems related to language services - FSAC or FCS

Comments

@matthid
Copy link
Contributor

matthid commented Sep 4, 2018

[11:01:56 ERROR] Project loading failed, error parsing ProjectCrackerTool output, stdoutput was:

stderr was:

Process is terminated due to StackOverflowException.

The project is a new-style SDK project, which looks like (names changed):

<Project>
  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
  <PropertyGroup>
    <AssemblyName>Server</AssemblyName>
    <OutputType>Exe</OutputType>
    <TargetFramework>net461</TargetFramework>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\Services\Services.Service\Services.Service.fsproj">
      <Private>True</Private>
    </ProjectReference>
    <ProjectReference Include="..\Services\Services.Messages.CSharp\Services.Messages.CSharp.csproj">
      <Private>True</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="../Shared/Shared.fs" />
    <Compile Include="../Shared/MiddlewareState.fs" />
    <Compile Include="basicAuth/BasicAuthentication.fs" />
    <Content Include="appsettings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Resources/localization_de.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Resources/localization_en.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Compile Include="ClientLogBatchProcessor.fs" />
    <Compile Include="Handler.fs" />
    <Compile Include="Startup.fs" />
    <Compile Include="Program.fs" />
    <None Include="paket.references" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System.Web" />
  </ItemGroup>
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
  <Target Name="Pack" />
  <Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

I thought the project cracker is not used for new-style sdk projects?

@matthid
Copy link
Contributor Author

matthid commented Sep 4, 2018

One other thing I noticed (and might be related). If the project looks like this:

<Project>
  <PropertyGroup>
    <AssemblyName>Server</AssemblyName>
    <OutputType>Exe</OutputType>
    <TargetFramework>net461</TargetFramework>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\Services\Services.Service\Services.Service.fsproj">
      <Private>True</Private>
    </ProjectReference>
    <ProjectReference Include="..\Services\Services.Messages.CSharp\Services.Messages.CSharp.csproj">
      <Private>True</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="../Shared/Shared.fs" />
    <Compile Include="../Shared/MiddlewareState.fs" />
    <Compile Include="basicAuth/BasicAuthentication.fs" />
    <Content Include="appsettings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Resources/localization_de.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Resources/localization_en.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Compile Include="ClientLogBatchProcessor.fs" />
    <Compile Include="Handler.fs" />
    <Compile Include="Startup.fs" />
    <Compile Include="Program.fs" />
    <None Include="paket.references" />
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System.Web" />
  </ItemGroup>
  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
  <Target Name="Pack" />
  <Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

(Notice the moved props import) then it doesn't load at all apparently. It builds and runs fine on the command line last time I checked.

@matthid
Copy link
Contributor Author

matthid commented Sep 4, 2018

Let me know if I can enable more logs somewhere, I haven't found anything else regarding logs or hints myself.

@MangelMaxime
Copy link
Contributor

MangelMaxime commented Sep 4, 2018

I don't know if this will contains logs about ProjectCrackerTool but in Ionide you can do:

  1. Ctrp + P > F#: Toggle Diagnostic
  2. Ctrp + P > Reload window
  3. Ctrp + P > F#: Get Ionide logs

@matthid
Copy link
Contributor Author

matthid commented Sep 4, 2018

Thanks, problem is the logfile contains source code, so I can only share privately. Also the error is not reproducible every time apparently, now I have a different one where it stays on loading.. forever. But there is always something wrong in this solution.

@MangelMaxime
Copy link
Contributor

Ah yes, we spoke about removing the code from the logs but never implemented it... Will add it to my todo :)

@MangelMaxime
Copy link
Contributor

In theory the logs should not include source code. We are not logging the parse command. Source

@matthid
Copy link
Contributor Author

matthid commented Sep 4, 2018

Well, I see source code in the logfile ;)

@Krzysztof-Cieslak
Copy link
Member

What's weird about it is that your project is SDK based, and the exception mentions ProjectCracker which should never be used with SDK based project files. Is one of the referenced projects non-SDK one?

@Krzysztof-Cieslak
Copy link
Member

Hmm...Ignore previous message... I think there is something that I don't know going on here. Doesn't most SDK projects have <Project Sdk="Microsoft.NET.Sdk"> as a first list? And what are <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> and <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> ? :-)

We probably don't detect it as SDK project, and try to crack it with ProjectCrapper, which obviously fails.

@Krzysztof-Cieslak Krzysztof-Cieslak added bug language services Problems related to language services - FSAC or FCS dotnet/sdk labels Sep 4, 2018
@Krzysztof-Cieslak
Copy link
Member

Yeah, it seems to be a case - check FSAC project type classification here - https://github.com/fsharp/FsAutoComplete/blob/master/src/FsAutoComplete.Core/ProjectCrackerTypes.fs#L67-L89

@matthid
Copy link
Contributor Author

matthid commented Sep 4, 2018

Is one of the referenced projects non-SDK one?

Indeed. In fact I would be happy if I could just disable that ionide is trying to load those...

don't detect it as SDK project,

Actually, that probably/hopefully explains a lot of weirdness I'm encountering with ionide. I often change the project file as shown above because you can overwrite sdk targets by importing the sdk in this explicit form...

@gibranrosa
Copy link

gibranrosa commented Jun 12, 2019

Hi! There is any workaround for this problem? I am getting the same error, but with a normal .net framework project generated in VS 2019.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>9de625a5-70cc-4032-9972-97bf1481ff7a</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <RootNamespace>PedidoZaffari</RootNamespace>
    <AssemblyName>PedidoZaffari</AssemblyName>
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <UseStandardResourceNames>true</UseStandardResourceNames>
    <WarningsAsErrors>3239;$(WarningsAsErrors)</WarningsAsErrors>
    <Name>PedidoZaffari</Name>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <Tailcalls>false</Tailcalls>
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <WarningLevel>3</WarningLevel>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
    <Prefer32Bit>true</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <Tailcalls>true</Tailcalls>
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <WarningLevel>3</WarningLevel>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile>
    <Prefer32Bit>true</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup>
    <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets') ">
    <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
  </PropertyGroup>
  <Import Project="$(FSharpTargetsPath)" />
  <ItemGroup>
    <Compile Include="CigamContext.fs" />
    <Compile Include="PedidoZaffari.fs" />
    <Compile Include="AssemblyInfo.fs" />
    <Compile Include="Program.fs" />
    <None Include="App.config" />
    <Content Include="packages.config" />
    <None Include="CamposEDIItens.tsv">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Include="CamposEDIPedido.tsv">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="BouncyCastle.Crypto">
      <HintPath>packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
    </Reference>
    <Reference Include="Common.Logging">
      <HintPath>packages\Common.Logging.3.4.1\lib\net40\Common.Logging.dll</HintPath>
    </Reference>
    <Reference Include="Common.Logging.Core">
      <HintPath>packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll</HintPath>
    </Reference>
    <Reference Include="FSharp.Core">
      <HintPath>packages\FSharp.Core.4.6.2\lib\net45\FSharp.Core.dll</HintPath>
    </Reference>
    <Reference Include="FSharp.Data">
      <HintPath>packages\FSharp.Data.3.1.1\lib\net45\FSharp.Data.dll</HintPath>
    </Reference>
    <Reference Include="FSharp.Data.SqlProvider">
      <HintPath>packages\SQLProvider.1.1.65\lib\net451\FSharp.Data.SqlProvider.dll</HintPath>
    </Reference>
    <Reference Include="itext.barcodes">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.barcodes.dll</HintPath>
    </Reference>
    <Reference Include="itext.forms">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.forms.dll</HintPath>
    </Reference>
    <Reference Include="itext.io">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.io.dll</HintPath>
    </Reference>
    <Reference Include="itext.kernel">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.kernel.dll</HintPath>
    </Reference>
    <Reference Include="itext.layout">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.layout.dll</HintPath>
    </Reference>
    <Reference Include="itext.pdfa">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.pdfa.dll</HintPath>
    </Reference>
    <Reference Include="itext.sign">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.sign.dll</HintPath>
    </Reference>
    <Reference Include="itext.styledxmlparser">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.styledxmlparser.dll</HintPath>
    </Reference>
    <Reference Include="itext.svg">
      <HintPath>packages\itext7.7.1.6\lib\net40\itext.svg.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="mscorlib" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Numerics" />
    <Reference Include="System.ValueTuple">
      <HintPath>packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml.Linq" />
  </ItemGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

@Krzysztof-Cieslak
Copy link
Member

This should be solved with moving to new project parsing in Ionide 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug language services Problems related to language services - FSAC or FCS
Development

No branches or pull requests

4 participants