Skip to content

[dotnet-sdk-10.0.100-alpha.1.25057.15] GitExtensions crashes due to Assembly.GetCallingAssembly().GetManifestResourceStream() doesn't load resource file #111399

@Junjun-zhao

Description

@Junjun-zhao

Description

When run the 3rd party application with the latest .NET 10 build, it breaks with error: System.TypeInitializationException: The type initializer for 'ICSharpCode.TextEditor.GutterMargin' threw an exception. After investigating, we found the issue is caused by Assembly.GetCallingAssembly().GetManifestResourceStream() method doesn't load the resource file when running against with .NET 10.

Application Name: GitExtensions
OS: Windows 10 22H2
CPU: X64
.NET Build Number: dotnet-sdk-10.0.100-alpha.1.25057.15
App & Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2344493
Github Link: https://github.com/gitextensions/gitextensions

Reproduction Steps

Source Repro steps: (Please get the repro machine information from Devdiv bug)

  1. Open C:\Users\Test01\Desktop\Source\gitextensionsGitExtensions.sln by VS 2022 preview.
  2. Build the project GitExtensions.
  3. Change the C:\Users\Test01\Desktop\Source\gitextensions\artifacts\Debug\bin\GitExtensions\net8.0-windows\GitExtensions.runtimeconfig and BugReporter.runtimeconfig.json file to let the app run against with dotnet-sdk-10.0.100-alpha.1.25057.15:
"frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "10.0.0-alpha.1.25052.4"
      },
      {
        "name": "Microsoft.WindowsDesktop.App",
        "version": "10.0.0-alpha.1.25056.2"
      }
    ]
  1. Start project GitExtensions.
  2. Close the Settings window.

App Repro steps on repro machine: (Please get the repro machine information from Devdiv bug)

  1. Change the C:\Users\Test01\Desktop\App\GitExtensions\GitExtensions.runtimeconfig and BugReporter.runtimeconfig.json file to let the app run against with dotnet-sdk-10.0.100-alpha.1.25057.15:
"frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "10.0.0-alpha.1.25052.4"
      },
      {
        "name": "Microsoft.WindowsDesktop.App",
        "version": "10.0.0-alpha.1.25056.2"
      }
    ]
  1. Launch C:\Users\Test01\Desktop\App\GitExtensions\GitExtensions.exe.
  2. Close the Settings window.

Expected behavior

Launch successfully.

Actual behavior

Launch failed with error:

System.TypeInitializationException: The type initializer for 'ICSharpCode.TextEditor.GutterMargin' threw an exception. ---> System.Exception: could not find cursor resource
   at ICSharpCode.TextEditor.GutterMargin..cctor() in D:\gitextensions\externals\ICSharpCode.TextEditor\Project\Src\Gui\GutterMargin.cs:line 30
   --- End of inner exception stack trace ---
   at ICSharpCode.TextEditor.GutterMargin..ctor(TextArea textArea) in D:\gitextensions\externals\ICSharpCode.TextEditor\Project\Src\Gui\GutterMargin.cs:line 23
   at ICSharpCode.TextEditor.TextArea..ctor(TextEditorControl motherTextEditorControl, TextAreaControl motherTextAreaControl) in D:\gitextensions\externals\ICSharpCode.TextEditor\Project\Src\Gui\TextArea.cs:line 87
   at ICSharpCode.TextEditor.TextAreaControl..ctor(TextEditorControl motherTextEditorControl) in D:\gitextensions\externals\ICSharpCode.TextEditor\Project\Src\Gui\TextAreaControl.cs:line 45
   at ICSharpCode.TextEditor.TextEditorControl..ctor() in D:\gitextensions\externals\ICSharpCode.TextEditor\Project\Src\Gui\TextEditorControl.cs:line 42
   at GitUI.Editor.FileViewerInternal.InitializeComponent() in D:\gitextensions\src\app\GitUI\Editor\FileViewerInternal.Designer.cs:line 31
   at GitUI.Editor.FileViewerInternal..ctor() in D:\gitextensions\src\app\GitUI\Editor\FileViewerInternal.cs:line 41
   at GitUI.Editor.FileViewer.InitializeComponent() in D:\gitextensions\src\app\GitUI\Editor\FileViewer.Designer.cs:line 64
   at GitUI.Editor.FileViewer..ctor() in D:\gitextensions\src\app\GitUI\Editor\FileViewer.cs:line 76
   at GitUI.CommandsDialogs.RevisionFileTreeControl.InitializeComponent() in D:\gitextensions\src\app\GitUI\CommandsDialogs\RevisionFileTreeControl.Designer.cs:line 53
   at GitUI.CommandsDialogs.RevisionFileTreeControl..ctor() in D:\gitextensions\src\app\GitUI\CommandsDialogs\RevisionFileTreeControl.cs:line 60
   at GitUI.CommandsDialogs.FormBrowse.InitializeComponent() in D:\gitextensions\src\app\GitUI\CommandsDialogs\FormBrowse.Designer.cs:line 73
   at GitUI.CommandsDialogs.FormBrowse..ctor(IGitUICommands commands, BrowseArguments args, SettingsSource settingsSource) in D:\gitextensions\src\app\GitUI\CommandsDialogs\FormBrowse.cs:line 258
   at GitUI.CommandsDialogs.FormBrowse..ctor(IGitUICommands commands, BrowseArguments args) in D:\gitextensions\src\app\GitUI\CommandsDialogs\FormBrowse.cs:line 244
   at GitUI.GitUICommands.StartBrowseDialog(IWin32Window owner, BrowseArguments args) in D:\gitextensions\src\app\GitUI\GitUICommands.cs:line 1150
   at GitExtensions.Program.RunApplication() in D:\gitextensions\src\app\GitExtensions\Program.cs:line 198
   at GitExtensions.Program.Main() in D:\gitextensions\src\app\GitExtensions\Program.cs:line 110


Regression?

Yes
Verify Scenarios:
1). Windows 10 22H2 AMD64 + dotnet-sdk-9.0.102: Pass
2). Windows 10 22H2 AMD64 + dotnet-sdk-10.0.100-alpha.1.25057.15: Fail

Known Workarounds

No response

Configuration

Dotnet info:

.NET SDK:
 Version:           10.0.100-alpha.1.25057.15
 Commit:            39da6dde11
 Workload version:  10.0.100-manifests.a166a9cf
 MSBuild version:   17.14.0-preview-25056-07+8d395fd27

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\10.0.100-alpha.1.25057.15\

Host:
  Version:      10.0.0-alpha.1.25052.4
  Architecture: x64
  Commit:       efdd299533

.NET SDKs installed:
  10.0.100-alpha.1.25057.15 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 10.0.0-alpha.2.25056.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 10.0.0-alpha.1.25052.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 10.0.0-alpha.1.25056.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other information

Findings:
When debugging into the app source code, we found the problem should be caused by below line of code (line27 In ICSharpCode.TextEditor.Src.Gui.GutterMargin.cs), it doesn't load the resource file with .NET 10 runtime:
var cursorStream = Assembly.GetCallingAssembly().GetManifestResourceStream("ICSharpCode.TextEditor.Resources.RightArrow.cur")

@dotnet-actwx-bot @dotnet/compat

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions