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

Commit Image error the value of '102' is not valid for 'value' #170

Open
i2i8 opened this issue Jul 11, 2022 · 6 comments
Open

Commit Image error the value of '102' is not valid for 'value' #170

i2i8 opened this issue Jul 11, 2022 · 6 comments

Comments

@i2i8
Copy link

i2i8 commented Jul 11, 2022

When I commit install.wim, it cannot unmount normally
DismApi.UnmountImage(mountedImageInfo.MountPath, commitChanges: true, progressCallback: ImageProgressCallback);
the error is as follows:

System. Argumentoutofrangeexception: the value of '102' is not valid for 'value'. 'value' should be between'minimum'and'maximum'. (Parameter 'value')

When I discard install.wim, it can unmount normally
DismApi.UnmountImage(mountedImageInfo.MountPath, commitChanges: false, progressCallback: ImageProgressCallback);

@jeffkl
Copy link
Owner

jeffkl commented Jul 11, 2022

Does ImageProgressCallback do something special? Is the managed DISM API here on the callstack for the exception?

@jeffkl
Copy link
Owner

jeffkl commented Jul 11, 2022

This line is probably throwing:

MoHelper.ProgressBar.Value = progress.Current;

I'm not sure why but the DISMAPI value for progress.Current is not always 0-100. If you want to safely calculate progress by percent, you'll need to probably use Total and divide by Current?

The documentation doesn't specify what values to expect: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dismprogresscallback?view=windows-11

@i2i8
Copy link
Author

i2i8 commented Jul 11, 2022

I didn't fully understand the instructions in the link above. Can you give some examples?

@i2i8
Copy link
Author

i2i8 commented Jul 11, 2022

Like this?
MoHelper.ProgressBar.Value = progress.Total / progress.Current;

@i2i8
Copy link
Author

i2i8 commented Jul 11, 2022

Like this? If it looks like this, the error is as follows:
System.DivideByZeroException: Attempted to divide by zero.

@i2i8
Copy link
Author

i2i8 commented Jul 11, 2022

From the above code, you can get a sense of what I want to achieve. I am not sure if the code I wrote is elegant, can you give me an elegant implementation of MountImage or UnMountImage saving method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants