PostSharp causes "Could not load file or assembly " error

george_yefchak's Avatar

george_yefchak

24 Feb, 2018 05:40 PM

Hi,

I'm unable to build my project which uses a third-party DLL. (Actually the DLL is written elsewhere in my group, but that's not relevant here.) The DLL is not reference in any public property or other code feature which should be affected by the [NotifyPropertyChanged] PostScript aspect. However, adding [NotifyPropertyChanged] causes the build error shown in the attached file.

Looking at search results, I saw several discussions of redirection in the app.config file. However, there is nothing non-standard in my app.config file.

How can I avoid this build error?

Thanks,
--George

  1. Support Staff 1 Posted by PostSharp Techn... on 26 Feb, 2018 09:17 AM

    PostSharp Technologies's Avatar

    Hello George,

    as you have seen in the other discussions, we've been experiencing various issues of this kind in PostSharp 5.0. This led us to redesign the part of PostSharp which is responsible for build-time assembly loading. Since this is a significant change, we had to make it in the next version to keep compatibility.

    (See our blog-post for details: http://www.postsharp.net/blog/post/Announcing-PostSharp-51-Preview-...)

    May I ask you to try to build your project with PostSharp 5.1 preview to see if your issue has been solved there?

    In case the issue is present in PostSharp 5.1 as well, the best way for us to figure out the root cause would be a project which reproduces the issue. This conversation can be turned to be private so your data is not shared. If providing a project is not possible, please send us a detailed build log. (Use MSBuild with /v:d switch.)

    Best regards,
    -tony

  2. 2 Posted by george_yefchak on 26 Feb, 2018 06:02 PM

    george_yefchak's Avatar

    Hi,

    Thanks. I'm willing to try the 5.1 preview, but could you send instructions on best to download and install it, etc.? I'm not especially fluent in NuGet, though I have managed to install the current PostSharp libraries.

    Thanks,
    --George

  3. Support Staff 3 Posted by PostSharp Techn... on 27 Feb, 2018 09:31 AM

    PostSharp Technologies's Avatar

    Hi,

    to update PostSharp NuGet packages:

    1) Right click on the project you want to modify in Visual Studio Solution Explorer
    2) Click on "Manage NuGet Packages". The NuGet Pakcage Manager tab for your project opens.
    3) Select "Updates" on the top of the tab (next to "Browse" and "Installed").
    4) Check the "Include prerelease" check-box.
    5) Check the "PostSharp" package and all packages beginning with "PostSharp.".
    6) Click on the "Update" button. You should be asked to confirm to update the packages to version 5.1.4-alpha.
    7) Confirm the update.

    You might have the confirmation disabled. In such case, the packages get updated immediately after clicking on the "Update" button.

    You should see the update process in the Package Manager Output windows.

    At this moment, in the "Installed" tab of the Package Manager tab, you should see all the packages updated to version 5.1.4-alpha.

    Now you can try to rebuild your project.

    Best regards,
    -tony

  4. 4 Posted by george_yefchak on 27 Feb, 2018 05:35 PM

    george_yefchak's Avatar

    Hi,

    Thanks. This did not fix the error.

    I can attempt to generate a small app that replicates the problem. I'll have to check with some folks here, though, as this will involve sending a number of proprietary DLLs to you.

    --George

  5. 5 Posted by george_yefchak on 27 Feb, 2018 05:48 PM

    george_yefchak's Avatar

    Actually, something else may be going on. I just realized that the error message now states a processor type mismatch, since for some reason it's trying to find an amd64 version. Not sure where that came from, so I'll keep digging....

  6. 6 Posted by george_yefchak on 27 Feb, 2018 06:52 PM

    george_yefchak's Avatar

    Hi again,

    ... Hmm I was able to get it to compile and run by specifying the x64 target. Not sure what that means, as AnyCPU has worked before.

  7. Support Staff 7 Posted by PostSharp Techn... on 06 Mar, 2018 09:56 AM

    PostSharp Technologies's Avatar

    Hello George,

    if you could manage to isolate the problem we would be truly grateful. In any case, thanks a lot for an update.

    All the best,
    Daniel

  8. 8 Posted by george_yefchak on 06 Mar, 2018 05:56 PM

    george_yefchak's Avatar

    Hi,

    I'll try to build a sample app for you, but it will take a while.

    In the meantime, can you answer a much easier question? Consider the normal boilerplate code shown below:

    public int MyValue
            {
                get { return _myValue; }
                set
                {
                    _ myValue = value;
                    DoSomethingElseHere();
                }
            }

    Note that I need to do something in the setter besides just setting the value. How do I implement this using PostSharp?

    Thanks,
    --George

  9. Support Staff 9 Posted by PostSharp Techn... on 07 Mar, 2018 08:53 AM

    PostSharp Technologies's Avatar

    Hello George,

    you can use LocationInterceptionAspect (see this page) and then you will be able to use auto properties, which improves readability quite a bit.

    Best regards,
    Daniel

  10. Support Staff 10 Posted by PostSharp Techn... on 21 Mar, 2018 01:20 PM

    PostSharp Technologies's Avatar

    Hello,

    We are going to close this request as there have not been any further updates. Please feel free to reopen the discussion if you need more help.

    Thanks,
    PostSharp Team

  11. PostSharp Technologies closed this discussion on 21 Mar, 2018 01:20 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac