eclipse-aaspe / package-explorer

AASX Package Explorer
Other
55 stars 20 forks source link

Temporary files inherit the write protection attribute of the opened file #166

Open WelliSolutions opened 9 months ago

WelliSolutions commented 9 months ago

Describe the bug Package Explorer complains about "Access denied" of a temporary file. The user has nothing to do with that temporary file, so it's the responsibility of Package Explorer to avoid this "Access denied" problem.

To Reproduce

  1. Make an arbitrary AASX file read only in Windows Explorer.
  2. Drag'n'drop the file onto Package Explorer.
  3. Package Explorer does not open the file. The error messages are not helpful, because they point to a temporary file which is not under control of the user.

Expected behavior Package Explorer can open the read-only file and display the contents.

Screenshots Screenshot does not help.

Desktop (please complete the following information):

Additional context One log as example, personal data removed.

Application startup.
The default options are expected in the JSON file: B:\...\AasxPackageExplorer\AasxPackageExplorer.options.json
Loading the default options from: B:\...\AasxPackageExplorer\AasxPackageExplorer.options.json
Parsing 0 command-line option(s)...
Searching for the plugins in the plugin directory: B:\...\AasxPackageExplorer\.\plugins
Found 16 plugin(s) in the plugin directory: B:\...\AasxPackageExplorer\.\plugins
Loading and activating 16 plugin(s)...
Trying to load and activate 16 plug-in(s)...
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginAdvancedTextEditor\AasxPluginAdvancedTextEditor.dll
.. adding plugin AasxPluginAdvancedTextEditor
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginBomStructure\AasxPluginBomStructure.dll
.. adding plugin AasxPluginBomStructure
.. found 1 menu items.
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginContactInformation\AasxPluginContactInformation.dll
.. adding plugin AasxPluginContactInformation
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginDigitalNameplate\AasxPluginDigitalNameplate.dll
.. adding plugin AasxPluginDigitalNameplate
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginDocumentShelf\AasxPluginDocumentShelf.dll
.. adding plugin AasxPluginDocumentShelf
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginExportTable\AasxPluginExportTable.dll
.. adding plugin AasxPluginExportTable
.. found 5 menu items.
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginGenericForms\AasxPluginGenericForms.dll
.. adding plugin AasxPluginGenericForms
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginImageMap\AasxPluginImageMap.dll
.. adding plugin AasxPluginImageMap
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginKnownSubmodels\AasxPluginKnownSubmodels.dll
.. adding plugin AasxPluginKnownSubmodels
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginMtpViewer\AasxPluginMtpViewer.dll
.. adding plugin AasxPluginMtpViewer
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginPlotting\AasxPluginPlotting.dll
.. adding plugin AasxPluginPlotting
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginSmdExporter\AasxPluginSmdExporter.dll
.. adding plugin AasxPluginSmdExporter
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginTechnicalData\AasxPluginTechnicalData.dll
.. adding plugin AasxPluginTechnicalData
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginUaNetClient\AasxPluginUaNetClient.dll
.. adding plugin AasxPluginOpcUaClient
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginUaNetServer\AasxPluginUaNetServer.dll
.. adding plugin AasxPluginUaNetServer
Trying to load a DLL: B:\...\AasxPackageExplorer\.\plugins\AasxPluginWebBrowser\AasxPluginWebBrowser.dll
.. adding plugin AasxPluginWebBrowser
Loading aasx file repository ..\..\..\..\..\Sample_AAS\aasxrepo-new.json ..
File not found when loading aasx file repository ..\..\..\..\..\Sample_AAS\aasxrepo-new.json
Application started ..
[AasxPluginAdvancedTextEditor] ListActions() called
[AasxPluginAdvancedTextEditor] InitPlugin() called with args = 
[AasxPluginBomStructure] InitPlugin() called with args = 
[AasxPluginContactInformation] InitPlugin() called with args = 
[AasxPluginDigitalNameplate] InitPlugin() called with args = 
[AasxPluginDocumentShelf] InitPlugin() called with args = 
[AasxPluginExportTable] InitPlugin() called with args = 
[AasxPluginGenericForms] InitPlugin() called with args = 
[AasxPluginGenericForms] Try load options from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\AasxPluginGenericForms.options.json ..
[AasxPluginGenericForms] Detected an old version of options: AAS2.0.1. Upgrading from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\AasxPluginGenericForms_Festo_ElectricAndFluidPlan.add-options.json ..
[AasxPluginGenericForms] Upgraded successfully! Consider saving options in new format.
[AasxPluginGenericForms] Detected an old version of options: AAS2.0.1. Upgrading from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\AasxPluginGenericForms_HSU_Identification.add-options.json ..
[AasxPluginGenericForms] Upgraded successfully! Consider saving options in new format.
[AasxPluginGenericForms] Detected an old version of options: AAS2.0.1. Upgrading from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\AasxPluginGenericForms_HSU_Nameplate.add-options.json ..
[AasxPluginGenericForms] Upgraded successfully! Consider saving options in new format.
[AasxPluginGenericForms] Detected an old version of options: AAS2.0.1. Upgrading from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\AasxPluginGenericForms_SG2_TechnicalData.add-options.json ..
[AasxPluginGenericForms] Upgraded successfully! Consider saving options in new format.
[AasxPluginGenericForms] Detected an old version of options: AAS2.0.1. Upgrading from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\AasxPluginGenericForms_SG2_TechnicalData_v11.add-options.json ..
[AasxPluginGenericForms] Upgraded successfully! Consider saving options in new format.
[AasxPluginGenericForms] Detected an old version of options: AAS2.0.1. Upgrading from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\AasxPluginGenericForms_ZVEI_DigitalNameplate.add-options.json ..
[AasxPluginGenericForms] Upgraded successfully! Consider saving options in new format.
[AasxPluginGenericForms] Try load options from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\IDTA 02004-1-2_Template_Handover Documentation.add-options.json ..
[AasxPluginGenericForms] Try load options from B:\...\AasxPackageExplorer\plugins\AasxPluginGenericForms\IDTA_02002-1-0_Template_ContactInformation.add-options.json ..
[AasxPluginImageMap] ListActions() called
[AasxPluginImageMap] InitPlugin() called with args = 
[AasxPluginKnownSubmodels] ListActions() called
[AasxPluginKnownSubmodels] InitPlugin() called with args = 
[AasxPluginMtpViewer] ListActions() called
[AasxPluginMtpViewer] InitPlugin() called with args = 
[AasxPluginPlotting] ListActions() called
[AasxPluginPlotting] InitPlugin() called with args = 
[AasxPluginSmdExporter] InitPlugin() called with args = 
[AasxPluginTechnicalData] ListActions() called
[AasxPluginTechnicalData] InitPlugin() called with args = 
[AasxPluginOpcUaClient] InitPlugin() called with args = 
[AasxPluginUaNetServer] InitPlugin() called with args = 
[AasxPluginWebBrowser] ListActions() called
[AasxPluginWebBrowser] InitPlugin() called with args = 
Loading new AASX from: Z:\01_Festo.aasx as auxiliary False ..
Error: while receiving file drop to window: PackageCentral: while performing load from Z:\01_Festo.aasx at \PackageCentral.cs:line 83 gave: One or more errors occurred. (While opening aasx C:\Users\T\AppData\Local\Temp\tmpAFA.aasx from source local file: Z:\01_Festo.aasx buffered to: C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 371 gave: While opening the package to read AASX C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 362 gave: Access to the path 'C:\Users\T\AppData\Local\Temp\tmpAFA.aasx' is denied.) PackageCentral: while performing load from Z:\01_Festo.aasx at \PackageCentral.cs:line 83 gave: One or more errors occurred. (While opening aasx C:\Users\T\AppData\Local\Temp\tmpAFA.aasx from source local file: Z:\01_Festo.aasx buffered to: C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 371 gave: While opening the package to read AASX C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 362 gave: Access to the path 'C:\Users\T\AppData\Local\Temp\tmpAFA.aasx' is denied.)
InnerException: One or more errors occurred. (While opening aasx C:\Users\T\AppData\Local\Temp\tmpAFA.aasx from source local file: Z:\01_Festo.aasx buffered to: C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 371 gave: While opening the package to read AASX C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 362 gave: Access to the path 'C:\Users\T\AppData\Local\Temp\tmpAFA.aasx' is denied.)
InnerException: While opening aasx C:\Users\T\AppData\Local\Temp\tmpAFA.aasx from source local file: Z:\01_Festo.aasx buffered to: C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 371 gave: While opening the package to read AASX C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 362 gave: Access to the path 'C:\Users\T\AppData\Local\Temp\tmpAFA.aasx' is denied. at    at AasxPackageLogic.PackageCentral.PackageCentralItem.Load(PackageCentral packageCentral, String location, String fullItemLocation, Boolean overrideLoadResident, PackageContainerOptionsBase containerOptions, PackCntRuntimeOptions runtimeOptions) in D:\a\aasx-package-explorer\aasx-package-explorer\src\AasxPackageLogic\PackageCentral\PackageCentral.cs:line 102
   at AasxPackageExplorer.MainWindow.UiLoadPackageWithNew(PackageCentralItem packItem, AdminShellPackageEnv takeOverEnv, String loadLocalFilename, String info, Boolean onlyAuxiliary, Boolean doNotNavigateAfterLoaded, PackageContainerBase takeOverContainer, String storeFnToLRU, Boolean indexItems) in D:\a\aasx-package-explorer\aasx-package-explorer\src\AasxPackageExplorer\MainWindow.xaml.cs:line 376
   at AasxPackageExplorer.MainWindow.Window_Drop(Object sender, DragEventArgs e) in D:\a\aasx-package-explorer\aasx-package-explorer\src\AasxPackageExplorer\MainWindow.xaml.cs:line 3364.Inner message: One or more errors occurred. (While opening aasx C:\Users\T\AppData\Local\Temp\tmpAFA.aasx from source local file: Z:\01_Festo.aasx buffered to: C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 371 gave: While opening the package to read AASX C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 362 gave: Access to the path 'C:\Users\T\AppData\Local\Temp\tmpAFA.aasx' is denied.)
Inner message: While opening aasx C:\Users\T\AppData\Local\Temp\tmpAFA.aasx from source local file: Z:\01_Festo.aasx buffered to: C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 371 gave: While opening the package to read AASX C:\Users\T\AppData\Local\Temp\tmpAFA.aasx at \AdminShellPackageEnv.cs:line 362 gave: Access to the path 'C:\Users\T\AppData\Local\Temp\tmpAFA.aasx' is denied.

    Stacktrace:    at AasxPackageLogic.PackageCentral.PackageCentralItem.Load(PackageCentral packageCentral, String location, String fullItemLocation, Boolean overrideLoadResident, PackageContainerOptionsBase containerOptions, PackCntRuntimeOptions runtimeOptions) in D:\a\aasx-package-explorer\aasx-package-explorer\src\AasxPackageLogic\PackageCentral\PackageCentral.cs:line 102
   at AasxPackageExplorer.MainWindow.UiLoadPackageWithNew(PackageCentralItem packItem, AdminShellPackageEnv takeOverEnv, String loadLocalFilename, String info, Boolean onlyAuxiliary, Boolean doNotNavigateAfterLoaded, PackageContainerBase takeOverContainer, String storeFnToLRU, Boolean indexItems) in D:\a\aasx-package-explorer\aasx-package-explorer\src\AasxPackageExplorer\MainWindow.xaml.cs:line 376
   at AasxPackageExplorer.MainWindow.Window_Drop(Object sender, DragEventArgs e) in D:\a\aasx-package-explorer\aasx-package-explorer\src\AasxPackageExplorer\MainWindow.xaml.cs:line 3364
juileetikekar commented 7 months ago

Hi @WelliSolutions,

Thank you for rasing the issue!

The issue has been successfully reproduced. We will keep you informed with further updates.