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

bug: Unhandled Exception #6

Closed
tysonsearls opened this issue Aug 7, 2024 · 15 comments
Closed

bug: Unhandled Exception #6

tysonsearls opened this issue Aug 7, 2024 · 15 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@tysonsearls
Copy link

Bug Report

1.0.5.9

Current behavior:

While running it the app crashes "Unhandled Exception" with System.text.json version 8.0.0.3

Expected behavior:

it would complete the backup

Steps to reproduce:

every time I run it on the command line

Related code:

Welcome to Azure DevOps Backup, v.1.0.5.9 by Michael Morten Sonne

Checking if the 7 required arguments is present (--token, --org, --backup, --server, --port, --from, --to)...
Checked if the 7 required arguments is present (--token, --org, --backup, --server, --port, --from, --to) - all is fine!
Email report priority arguments is set to: Low
Starting connection to Azure DevOps API from data provided from arguments
Base URL is for Organization is: 'https://dev.azure.com/neocioweb/'
Output folder is: 'D:\NeociowebCodeBackups\07-08-2024-(11-49)'
Output folder does not exists - trying to create 'D:\NeociowebCodeBackups\07-08-2024-(11-49)'...
Output folder is created: 'D:\NeociowebCodeBackups\07-08-2024-(11-49)'

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at RestSharp.Serializers.Json.SystemTextJsonSerializer..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstanceT
at RestSharp.Serializers.SerializerConfig.<>c__51.<UseSerializer>b__5_0() at RestSharp.Serializers.SerializerConfig.UseSerializer(Func1 serializerFactory)
at RestSharp.RestClient.ConfigureSerializers(ConfigureSerialization configureSerialization)
at RestSharp.RestClient..ctor(RestClientOptions options, ConfigureHeaders configureDefaultHeaders, ConfigureSerialization configureSerialization, Boolean useClientFactory)
at RestSharp.RestClient..ctor(String baseUrl, ConfigureRestClient configureRestClient, ConfigureHeaders configureDefaultHeaders, ConfigureSerialization configureSerialization)
at AzureDevOpsBackup.Program.

d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at AzureDevOpsBackup.Program.(String[] args)

insert short code snippets here

Other information:

Thanks! Really looking forward to backing up my devops code with your app.

@tysonsearls tysonsearls added the bug Something isn't working label Aug 7, 2024
@michaelmsonne
Copy link
Owner

Hi @tysonsearls,
Thanks for the report :)
Just to confirm a few things, have you installed the tool via the provided installer, and what Windows OS are you running?
Looking forward to your reply.
Thanks.

@tysonsearls
Copy link
Author

tysonsearls commented Aug 7, 2024

Yes, via the installer the msi file and windows server 2016

Update: I was able to get it to work/run by github cloning the older version to VS 1.0.5.8 and doing a nuget update to Newtonsoft.json and RestSharp to the newest versions. I am running the exe from the build bin folder without the installer. It looks like RestSharp was looking to the older version of Newtonsoft.json

@michaelmsonne
Copy link
Owner

Thanks for that! - I will look into it, what have been made and in the installer - looks like some mismatch 🫣

@tysonsearls
Copy link
Author

Hey, this is a side question. What good are the zip files? if you open them up it doesn't contain the code folder structure but guid files that have random characters. How do you restore the zip files to the code folder structure?

@michaelmsonne
Copy link
Owner

Hi @tysonsearls,

Good question :)

The RAW data from the Azure DevOps API is the .zip files containing the guid/metadata from it.
The content is in the files, but the filenames is not the correct ones no (don´t ask me why..).

To get the files name and the correct content, you will need to set the --unzip argument - it will unsip it and mark the guid/metadata together to the files.

@tysonsearls
Copy link
Author

tysonsearls commented Aug 8, 2024

Ok, We have a lot of projects with many branches, so unzipped the disk could get full very fast, I was wanting to have your tool download them as a zip and unzip them manually when needed for disaster preparedness. Do you know of a way to do that? to have your tool download them as a zip then unzip them to something I can use? if not what is the point of downloading them zipped?

@michaelmsonne
Copy link
Owner

At the moment the tool can´t that ( unzip them manually when needed for disaster preparedness).

There is the --unzip argument to unzip the files when it got it from the API (.zip files, Microsoft decision as that the raw data retuned form the API), and then set the --cleanup argument to cleanup the .zip files when downloaded and unzipped.

@michaelmsonne
Copy link
Owner

I see the bug in the new installer - strange, as it was tested..

I see the code refer to some v. of assembly not here.

But I have now tested it, and I can fine run the files compiled in the bin folder - but not if installing it via the installer.
It´s something with the installer as I see it.

Looking into it.

@michaelmsonne
Copy link
Owner

Tested it - the file "AzureDevOpsBackup.exe.config" is missing in the installer.

I will fix.

@michaelmsonne
Copy link
Owner

michaelmsonne commented Aug 8, 2024

Hi @tysonsearls ,

Fixed installer and some small other changes.

Get it here: https://github.com/michaelmsonne/AzureDevOpsBackupTool/releases/tag/1.0.6.0

Will look into a small tool aside to match the guid data to files for restore repos on-demand.

Will update you.

Thanks for the feedback! :)

EDIT: Fixed wrong link

@tysonsearls
Copy link
Author

Thanks for you help Michael!

@michaelmsonne
Copy link
Owner

Allways @tysonsearls - sitting right now in Visual Studio and are in the makeing of a "AzureDevOpsBackupUnzipTool.exe" :)

@michaelmsonne
Copy link
Owner

Hi @tysonsearls ,

For a tool to unzip single repos based on .zip content and .json metadata - take a look here in development: https://github.com/michaelmsonne/AzureDevOpsBackupTool/tree/Add-toolToUnzipSingleBackup :)

@michaelmsonne michaelmsonne added the enhancement New feature or request label Aug 8, 2024
@tysonsearls
Copy link
Author

Thanks Michael!

@michaelmsonne michaelmsonne changed the title bug: bug: Unhandled Exception Aug 9, 2024
@michaelmsonne
Copy link
Owner

I will close this one as the bug is fixed with a new installer (missing .config file).

I will update the rest when it´s tested and a new v. is out :)

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

No branches or pull requests

2 participants