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

NullReferenceException in compiler #18218

Open
majocha opened this issue Jan 8, 2025 · 0 comments
Open

NullReferenceException in compiler #18218

majocha opened this issue Jan 8, 2025 · 0 comments
Labels
Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@majocha
Copy link
Contributor

majocha commented Jan 8, 2025

Severity is probably low.

I noticed locally Error 193 in some tests that were possibly crashing the testhost in CI.
Running in debug I managed to capture a stacktrace so I post it here to not lose it:

 Interop.Required and init-only properties.F# should produce compile-time error when required properties are not specified in the initializer
   Source: RequiredAndInitOnlyProperties.fs line 295

  Iteration 75)   Interop.Required and init-only properties.F# should produce compile-time error when required properties are not specified in the initializer 
     Duration: 4 sec

    Message: 
System.AggregateException : One or more errors occurred. (Method Debug.Fail failed with 'Unknown exception seen in compiler: Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with 'Unknown exception seen in compiler: Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with 'Unknown exception seen in compiler: Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with 'Unknown exception seen in compiler: Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with 'Unknown exception seen in compiler: Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with 'Unknown exception seen in compiler: Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with 'Unknown exception seen in compiler: Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with 'Unknown exception seen in compiler: Microsoft.VisualStudio.TestPlatform.TestHost.DebugAssertException: Method Debug.Fail failed with 'Unexpected exception raised in compiler: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at FSharp.Compiler.Text.Layout.get_Tag()
   at FSharp.Compiler.Text.LayoutModule.isEmptyL(Layout layout) in E:\repos\fsharp\src\Compiler\Utilities\sformat.fs:line 295
   at FSharp.Compiler.Text.LayoutModule.mkNode(Layout l, Layout r, Joint joint) in E:\repos\fsharp\src\Compiler\Utilities\sformat.fs:line 309
   at FSharp.Compiler.Text.LayoutModule.op_HatHat(Layout layout1, Layout layout2) in E:\repos\fsharp\src\Compiler\Utilities\sformat.fs:line 322
   at FSharp.Compiler.NicePrint.InfoMemberPrinting.prettyLayoutOfPropInfoFreeStyle(TcGlobals g, ImportMap amap, Range m, DisplayEnv denv, PropInfo pinfo) in E:\repos\fsharp\src\Compiler\Checking\NicePrint.fs:line 1793
   at FSharp.Compiler.NicePrint.InfoMemberPrinting.formatPropInfoToBufferFreeStyle(TcGlobals g, ImportMap amap, Range m, DisplayEnv denv, StringBuilder os, PropInfo pinfo) in E:\repos\fsharp\src\Compiler\Checking\NicePrint.fs:line 1805
   at [email protected](StringBuilder buf) in E:\repos\fsharp\src\Compiler\Checking\NicePrint.fs:line 2805
   at Internal.Utilities.Library.Extras.buildString(FSharpFunc`2 f) in E:\repos\fsharp\src\Compiler\Utilities\lib.fs:line 286
   at FSharp.Compiler.NicePrint.Pipe #1 stage #1 at line [email protected](PropInfo pinfo)
   at FSharp.Compiler.NicePrint.Pipe #1 stage #1 at line [email protected](PropInfo x)
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x) in E:\repos\fsharp\src\FSharp.Core\local.fs:line 249
   at Microsoft.FSharp.Collections.ListModule.Map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 list) in E:\repos\fsharp\src\FSharp.Core\list.fs:line 98
   at FSharp.Compiler.NicePrint.multiLineStringOfPropInfos(TcGlobals g, ImportMap amap, Range m, DisplayEnv denv, FSharpList`1 pinfos) in E:\repos\fsharp\src\Compiler\Checking\NicePrint.fs:line 2810
   at FSharp.Compiler.CheckExpressions.CheckRequiredProperties[a](TcGlobals g, TcEnv env, TcFileState cenv, MethInfo minfo, FSharpList`1 finalAssignedItemSetters, Range mMethExpr) in E:\repos\fsharp\src\Compiler\Checking\Expressions\CheckExpressions.fs:line 1326
...

Full stack trace:
F# should produce compile-time error when required properties are not specified in the initializer-638719431092933566.testlog.txt

Repro, as usual, is to select a whole bunch of tests (for example Interop) in VS and "run until failure".

@github-actions github-actions bot added this to the Backlog milestone Jan 8, 2025
@T-Gro T-Gro added Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. and removed Needs-Triage labels Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
Status: New
Development

No branches or pull requests

2 participants