-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Question/Issue] Blur in .NetStandard class library #5
Comments
Hey there, This is an issue encountered when VS keeps a file opened. Basically Blur extends the MSBuild process to edit files once they've been compiled by VS, but if it fails, sometimes MSBuild will keep these files opened, which means that Blur can't access them anymore. Lemme know if you want some more help. |
Ok, great. That lets me reattempt the build but now I'm getting a null AssemblyResolver in the Mono.Cecil.MetaDataResolver ctor. but I will look into that and ensure that it's not coming from my end. |
Sorry, but I can't reproduce your issue. From what I'm seeing, the problem comes from Mono.Cecil, and it looks like it has to do with #306 precisely, but that's quite weird because Blur uses its own AssemblyResolver. What version of Mono.Cecil is installed? |
I'm just using the Cecil that's included in the Blur NuGet. I created a completely fresh repo to try and clear any issues with old Cecil versions etc but I am still getting the error. Interestingly I managed to build once but there seems to be something very fragile in the build/clean/build sequence. My repo is here is you want to try and repro github.com/sebandraos/NetStandardILWeavingTest or if you can see something patently wrong in the usage. Cheers |
I'm encountering the same problem with your solution, and from what I'm seeing the problem somehow is my own. I'm trying to fix it right now, and will update you on the process. |
Thank you Grégoire. I'm more than happy to help debug or resolve issues. Don't hesitate to throw things my way.
|
Hi, Have you made any progress on this? Is there somewhere I should start looking for the bug? |
Hey there. I've been experimenting with a few different fixes, but so far nothing that really works. With school and everything, I can hardly make the time to debug, but I'll see what I can do. |
I am glad to say this issue has been fixed! I won't upload the fix before a long time because I have a lot of other bugs to fix and features to implement, but if you want to locally apply the fix, replace those lines by those: assembly = AssemblyDefinition.ReadAssembly(targetStream, new ReaderParameters
{
InMemory = true,
ReadWrite = false,
ReadingMode = ReadingMode.Immediate,
AssemblyResolver = new AssemblyResolver()
}); By the way, sorry for taking so much time to fix such a simple issue! I've been extremely busy with school and other projects, and kind of gave up after failing to fix the bug. |
That's great, thanks Grégoire. It might be a simple fix but that doesn't mean it's a simple bug. FYI I have made this change upon your latest commit in my fork and converted all the PCL projects to .NETStandard1.3. If it's of interest I can open a PR to merge those changes back into the master. |
Yep, I'm watching it and noticed you made a few changes. Unfortunately I've added a few more things to avoid parsing assemblies multiple times. Speaking of which, didn't you have any problems when switching to |
I was having issues but they have pretty much cleared up with my last few tweaks. I am only looking at the executable and library though, not the tests, CommonAttributes etc. as they seem to have other issues. I have now made the BLur.Libray auto-pack into a nuget and this works nicely. The only major issue I'm having is having to kill MSBuild after each build to be avoid a clash at the next. I managed to rebuild a version of Fody/PropertyChanged with Blur but whenever I tried to reference that package from another project things started getting very messy with the second project thinking BlurVisitor was defined in System.Diagnostics.Debug and therefore not being able to find it. |
Good work! Yeah they've had some weird bugs since I switched to the 2017 dotnet toolchain. I too have a problem with MSBuild, and can't get my hands on fixing it. What's really weird is that Fody doesn't have the same problem, even though it uses a similar process. I haven't had that problem yet, I'll look into it |
Hey, I'd just like to let you know that I just rewrote a big part of the processing part of Blur, which makes it much more stable. It also brings the ability to debug mixins, or weavers. I'd like to get a few other things done, and I'll push the changes. |
Hi,
I'm testing this as a .NetStandard compatible alternative to Fody but I'm coming up against some issues when referencing Blur 0.2.9-beta in a .NetStandard1.3 library. Is this indeed compatible with .NetStandard? If so, what is the appropriate setup? I am currently creating a file in my project and using it as an attribute, although I am planning on testing the Visitor pattern once this works. If this is not the right way, what is the correct setup for the targets etc.
Everything appears to be in place and I have copied the attribute setup as demonstrated in the readme but upon building I receive:
Severity Code Description Project File Line Suppression State Error CS2012 Cannot open 'd:\Documents\visual studio 2017\Projects\TestNetStandard\TestNetStandard\obj\Debug\netstandard1.3\TestNetStandard.pdb' for writing -- 'The process cannot access the file 'd:\Documents\visual studio 2017\Projects\TestNetStandard\TestNetStandard\obj\Debug\netstandard1.3\TestNetStandard.pdb' because it is being used by another process.' TestNetStandard d:\Documents\visual studio 2017\Projects\TestNetStandard\TestNetStandard\CSC 1 Active
Even if I change the Build Action of the attribute file (and remove references to it) to None, I get the same issue.
Cheers
The text was updated successfully, but these errors were encountered: