madskristensen / MarkdownEditor

A Visual Studio extension
Other
409 stars 93 forks source link

Files can't be opened - System.NullReferenceException is thrown in VS2022 #223

Closed rayphi closed 2 years ago

rayphi commented 2 years ago

Installed product versions

Description

When a file (of any type) is opened, a System.NullReferenceException is thrown. The extension is therefore not functional in VS2022.

Steps to recreate

  1. Install Extension
  2. Restart VS2022 (for installation)
  3. Open any file (no matter if .md or any other type)
  4. Tab is opened without content and the exception is thrown.

Current behavior

Files are displayed in tabs without content, usually this is very helpful to be able to see the content of Markdown files and other files you open in VS.

Exception from Logfile:

  <entry>
    <record>2364</record>
    <time>2021/10/08 09:20:00.078</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.PerformLayout(SnapshotPoint anchorPosition, Double verticalDistance, ViewRelativePosition relativeTo, Double effectiveViewportWidth, Double effectiveViewportHeight, Boolean preserveViewportTop, Nullable`1 cancel)&#x000D;&#x000A;
    --- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;
       at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
  </entry>
  <entry>
    <record>2365</record>
    <time>2021/10/08 09:20:00.094</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.PerformLayout(SnapshotPoint anchorPosition, Double verticalDistance, ViewRelativePosition relativeTo, Double effectiveViewportWidth, Double effectiveViewportHeight, Boolean preserveViewportTop, Nullable`1 cancel)&#x000D;&#x000A;
    --- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.PerformLayout(SnapshotPoint anchorPosition, Double verticalDistance, ViewRelativePosition relativeTo, Double effectiveViewportWidth, Double effectiveViewportHeight, Boolean preserveViewportTop, Nullable`1 cancel)&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.DisplayTextLineContainingBufferPosition(SnapshotPoint bufferPosition, Double verticalDistance, ViewRelativePosition relativeTo, Nullable`1 viewportWidthOverride, Nullable`1 viewportHeightOverride)&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.DisplayTextLineContainingBufferPosition(SnapshotPoint bufferPosition, Double verticalDistance, ViewRelativePosition relativeTo)&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Editor.Implementation.CollapsedAdornmentProvider.RaiseTagsChangedAndRefreshElisions(SnapshotSpan sourceSpan)&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Editor.Implementation.CollapsedAdornmentProvider.HandleRegionsChanged(Object sender, RegionsChangedEventArgs args)&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Outlining.OutliningManager.UpdateAfterChange(NormalizedSnapshotSpanCollection changedSpans)&#x000D;&#x000A;
       at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)&#x000D;&#x000A;
    --- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;
       at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
  </entry>

Expected behavior

Files should be able to be opened and edited in VS, that makes working with VS much easier.

lsoft commented 2 years ago

@rayphi I've installed same version of VSIX, but in VS2022 Preview 5, and can't reproduce your report, sorry.

изображение

rayphi commented 2 years ago

Yep I can confirm that.