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

Importing files can cause crash depending on project architecture #2212

Open
Doprez opened this issue Apr 5, 2024 · 2 comments
Open

Importing files can cause crash depending on project architecture #2212

Doprez opened this issue Apr 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Doprez
Copy link
Contributor

Doprez commented Apr 5, 2024

Release Type: Github and release

Version: master and 4.2.0.2122

Platform(s): Windows

Describe the bug
When you import a file into the game studio it will crash if the Resource folder is not in your main project folder.

the cause is this line in AssetCollectionViewModel.cs
var finalPath = Path.GetFullPath(Path.Combine(directory.Package.Package.ResourceFolders[0], path, file.GetFileName()));

since the directory.Package.Package.ResourceFolders[0] will throw an index out of bounds error.

To Reproduce
Steps to reproduce the behavior:

  1. create the default FPS template
  2. import any file like a 3d model
  3. select yes on the move file into project folder popup
  4. crash

Expected behavior
Either it should create a Resource folder where it expects it
or
it would ask you where it should save if it cant find a spot.

Additional context

Application: GameStudio
UserEmail: 
UserMessage: 
StrideVersion: 4.2.0.2122
GameStudioVersion: 4
ThreadName: Main thread
DefaultGraphicProfile: Level_10_0
OpenedAssets: f08ccb44-9a6a-40fa-a923-15c48cc1bc7d:MainScene (Scene)

LastActions: * +[Create folder "New folder" in "Assets"]
    * {PropertyChangeOperation: DirectoryViewModel.Parent}
* +[Rename folder "New folder" to "Test"]
    * {PropertyChangeOperation: DirectoryViewModel.Name}

CurrentDirectory: %USERPROFILE%\.nuget\packages\stride.gamestudio\4.2.0.2122\lib\net8.0-windows7.0
CommandArgs: C:\dev\stride-dev\FirstPersonShooter\FirstPersonShooter.sln
OsVersion: Microsoft Windows 10 Pro 10.0.19045 x64
ProcessorCount: 32
Exception: ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Stride.Core.Assets.Editor.ViewModel.AssetCollectionViewModel.GetAssetCopyDirectory(DirectoryBaseViewModel directory, UFile file) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\editor\Stride.Core.Assets.Editor\ViewModel\AssetCollectionViewModel.cs:line 542
   at Stride.Core.Assets.Editor.ViewModel.AssetCollectionViewModel.InvokeAddAssetTemplate(LoggerResult logger, String name, DirectoryBaseViewModel directory, TemplateAssetDescription templateDescription, IList`1 files, Nullable`1 customParameters) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\editor\Stride.Core.Assets.Editor\ViewModel\AssetCollectionViewModel.cs:line 594
   at Stride.Core.Assets.Editor.ViewModel.AssetCollectionViewModel.RunAssetTemplate(ITemplateDescriptionViewModel template, IList`1 files, Nullable`1 customParameters) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\editor\Stride.Core.Assets.Editor\ViewModel\AssetCollectionViewModel.cs:line 504
   at Stride.Core.Assets.Editor.ViewModel.AssetCollectionViewModel.Stride.Core.Assets.Editor.ViewModel.IAddChildViewModel.AddChildren(IReadOnlyCollection`1 children, AddChildModifiers modifiers) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\editor\Stride.Core.Assets.Editor\ViewModel\AssetCollectionViewModel.cs:line 1594
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at Stride.GameStudio.Program.Main() in C:\BuildAgent\work\b5f46e3c4829a09e\sources\editor\Stride.GameStudio\Program.cs:line 148

GPU0.AdapterCompatibility: Virtual Desktop, Inc.
GPU0.Availability: 8
GPU0.Caption: Virtual Desktop Monitor
GPU0.ConfigManagerErrorCode: 22
GPU0.ConfigManagerUserConfig: False
GPU0.CreationClassName: Win32_VideoController
GPU0.Description: Virtual Desktop Monitor
GPU0.DeviceID: VideoController1
GPU0.DriverDate: 20240114000000.000000-000
GPU0.DriverVersion: 10.54.50.446
GPU0.InfFilename: oem5.inf
GPU0.InfSection: MyDevice_Install.NT
GPU0.Monochrome: False
GPU0.Name: Virtual Desktop Monitor
GPU0.PNPDeviceID: ROOT\DISPLAY\0000
GPU0.Status: Error
GPU0.SystemCreationClassName: Win32_ComputerSystem
GPU0.SystemName: DESKTOP-AUQIATQ
GPU0.VideoArchitecture: 5
GPU0.VideoMemoryType: 2
GPU1.AdapterCompatibility: NVIDIA
GPU1.AdapterDACType: Integrated RAMDAC
GPU1.AdapterRAM: 4293918720
GPU1.Availability: 3
GPU1.Caption: NVIDIA GeForce RTX 3080
GPU1.ConfigManagerErrorCode: 0
GPU1.ConfigManagerUserConfig: False
GPU1.CreationClassName: Win32_VideoController
GPU1.CurrentBitsPerPixel: 32
GPU1.CurrentHorizontalResolution: 1920
GPU1.CurrentNumberOfColors: 4294967296
GPU1.CurrentNumberOfColumns: 0
GPU1.CurrentNumberOfRows: 0
GPU1.CurrentRefreshRate: 143
GPU1.CurrentScanMode: 4
GPU1.CurrentVerticalResolution: 1080
GPU1.Description: NVIDIA GeForce RTX 3080
GPU1.DeviceID: VideoController2
GPU1.DitherType: 0
GPU1.DriverDate: 20240301000000.000000-000
GPU1.DriverVersion: 31.0.15.5176
GPU1.InfFilename: oem94.inf
GPU1.InfSection: Section028
GPU1.InstalledDisplayDrivers: C:\WINDOWS\System32\DriverStore\FileRepository\nvmdi.inf_amd64_92b25561841a09dd\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvmdi.inf_amd64_92b25561841a09dd\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvmdi.inf_amd64_92b25561841a09dd\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvmdi.inf_amd64_92b25561841a09dd\nvldumdx.dll
GPU1.MaxRefreshRate: 164
GPU1.MinRefreshRate: 50
GPU1.Monochrome: False
GPU1.Name: NVIDIA GeForce RTX 3080
GPU1.PNPDeviceID: PCI\VEN_10DE&DEV_220A&SUBSYS_38961462&REV_A1\4&1D81E16&0&0019
GPU1.Status: OK
GPU1.SystemCreationClassName: Win32_ComputerSystem
GPU1.SystemName: DESKTOP-AUQIATQ
GPU1.VideoArchitecture: 5
GPU1.VideoMemoryType: 2
GPU1.VideoModeDescription: 1920 x 1080 x 4294967296 colors
GPU1.VideoProcessor: NVIDIA GeForce RTX 3080
Log: 1: Trigger/TriggerGroupException(0,0): []: Fatal: The asset Trigger/TriggerGroupException is missing or incorrectly indexed in the package. Please report this issue.
2: Trigger/TriggerEvent(0,0): []: Fatal: The asset Trigger/TriggerEvent is missing or incorrectly indexed in the package. Please report this issue.
3: Trigger/TriggerGroup(0,0): []: Fatal: The asset Trigger/TriggerGroup is missing or incorrectly indexed in the package. Please report this issue.
4: Trigger/TriggerScript(0,0): []: Fatal: The asset Trigger/TriggerScript is missing or incorrectly indexed in the package. Please report this issue.
5: FirstPersonShooterApp(0,0): []: Fatal: The asset FirstPersonShooterApp is missing or incorrectly indexed in the package. Please report this issue.
@Doprez Doprez added the bug Something isn't working label Apr 5, 2024
@Doprez Doprez changed the title Importing files can cause crash depending on prject architecture Importing files can cause crash depending on project architecture Apr 5, 2024
@Kryptos-FR
Copy link
Member

Kryptos-FR commented Apr 5, 2024

Is it from a new project or an existing one? The resource folder definition was missing from most of the templates but I fixed that some time ago.

Cf #2109

@Doprez
Copy link
Contributor Author

Doprez commented Apr 5, 2024

I only tried the FPS template and created it yesterday. It does seem like the changes arent in the sdpkg anymore when I create a new template but it was in your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants