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

UnauthorizedAccessException on YellowFlavor.Serialization.dll #90

Open
salem-mdimegh opened this issue May 28, 2024 · 8 comments
Open
Assignees
Labels

Comments

@salem-mdimegh
Copy link

Using Microsoft Visual Studio Enterprise 2022 (64-bit)
Version 17.9.6

Every time when I try to "Dump as" to any type.
Exception :

'System.Reflection.Assembly.LoadFile(@"c:\users\xxxxxxxxx\appdata\local\microsoft\visualstudio\17.0_607f993c\extensions\lzbpc2iq.5i1\InjectableLibs\net45\YellowFlavor.Serialization.dll")' threw an exception of type 'System.UnauthorizedAccessException'

@ycherkes
Copy link
Owner

ycherkes commented May 28, 2024

@salem-mdimegh Thank you for reporting this issue.
Could you paste it to code you debugging and check what happens?

 using System;
 using System.Security.Permissions;
 using System.Security;


var f1 = new FileIOPermission(FileIOPermissionAccess.Read, @"c:\users\xxxxxxxxx\appdata\local\microsoft\visualstudio\17.0_607f993c\extensions\lzbpc2iq.5i1\InjectableLibs\net45\YellowFlavor.Serialization.dll");
try
{
    f1.Demand();
}
catch (SecurityException s)
{
    Console.WriteLine(s.Message);
}

@ycherkes
Copy link
Owner

ycherkes commented May 28, 2024

Also, the information about the OS and .net framework version will be very helpful.

@ycherkes ycherkes added bug Something isn't working blocked labels May 28, 2024
@ycherkes ycherkes self-assigned this May 28, 2024
@ycherkes
Copy link
Owner

ycherkes commented May 28, 2024

I can't reproduce, so, just waiting for the input from reporter.

@ycherkes
Copy link
Owner

ycherkes commented May 28, 2024

Same bug was reported by Troy Loberger 10.04.23 in QA. netframework version of serialization library couldn't be loaded with the same exception.

I'm getting an authorization exception. I'm running VS as an administrator. Any thoughts?

'System.Reflection.Assembly.LoadFile(@"c:\users\MyName\appdata\local\microsoft\visualstudio\17.0_bc416d50\extensions\yt4v04nk.33h\InjectableLibs\net45\YellowFlavor.Serialization.dll")' threw an exception of type 'System.UnauthorizedAccessException'

@salem-mdimegh
Copy link
Author

OS : Windows 10 Entreprise 22H2
Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz 2.90 GHz
16,0 Go RAM

Microsoft Visual Studio Enterprise 2022 (64-bit) Version 17.9.6
ASP.NET MVC app
Target Framework : .NET Framework 4.7.2

the code given on prevous comment here, did not raise exception
image

@ycherkes
Copy link
Owner

ycherkes commented May 29, 2024

@salem-mdimegh
Could you please also run?

var assembly = System.Reflection.Assembly.LoadFile(@"c:\users\xxxxxxxxx\appdata\local\microsoft\visualstudio\17.0_607f993c\extensions\lzbpc2iq.5i1\InjectableLibs\net45\YellowFlavor.Serialization.dll");

@ycherkes
Copy link
Owner

Or even better this code. I will know if it can be used as a workaround:

var fileData = System.IO.File.ReadAllBytes(@"c:\users\xxxxxxxxx\appdata\local\microsoft\visualstudio\17.0_607f993c\extensions\lzbpc2iq.5i1\InjectableLibs\net45\YellowFlavor.Serialization.dll");
var base64String = Convert.ToBase64String(fileData);
var asm = System.Reflection.Assembly.Load(System.Convert.FromBase64String(base64String));

@ycherkes
Copy link
Owner

That could be related to CAS policy

caspol -all -lg

Try adding this library to fully trusted in the developer command prompt console under Administrator:

caspol -m -ag 1.2 -url "file:///c:/users/xxxxxxxxx/appdata/local/microsoft/visualstudio/17.0_607f993c/extensions/lzbpc2iq.5i1/InjectableLibs/net45/YellowFlavor.Serialization.dll" FullTrust

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

No branches or pull requests

2 participants