Giter VIP home page Giter VIP logo

Comments (17)

roji avatar roji commented on August 17, 2024

It seems like I'm getting this error while trying to compile Npgsql. The build output with a stack trace is below, please let me know if I can provide any more info.

(thanks for all the effort making CC work on VS2015!)

1>------ Rebuild All started: Project: Npgsql, Configuration: Debug Any CPU ------
1>  AsmMeta failed with uncaught exception: Unknown custom metadata item kind: 7
1>  Stack trace:    at Microsoft.Cci.Pdb.PdbFunction.ReadCustomMetadata(BitAccess bits)
1>     at Microsoft.Cci.Pdb.PdbFunction..ctor(ManProcSym proc, BitAccess bits)
1>     at Microsoft.Cci.Pdb.PdbFunction.LoadManagedFunctions(BitAccess bits, UInt32 limit, Boolean readStrings)
1>     at Microsoft.Cci.Pdb.PdbFile.LoadFuncsFromDbiModule(BitAccess bits, DbiModuleInfo info, IntHashTable names, ArrayList funcList, Boolean readStrings, MsfDirectory dir, Dictionary`2 nameIndex, PdbReader reader, Dictionary`2 sourceCache)
1>     at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, Dictionary`2& tokenToSourceMapping, String& sourceServerData)
1>     at Microsoft.Cci.PdbReader..ctor(Stream pdbStream, IMetadataHost host)
1>     at AsmMeta.AsmMeta.Run()
1>     at AsmMeta.AsmMeta.RealMain(String[] args)
1>     at AsmMeta.AsmMeta.Main(String[] args)
1>  elapsed time: 226.1501ms
1>C:\Program Files (x86)\Microsoft\Contracts\MsBuild\v14.0\Microsoft.CodeContracts.targets(356,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrefgen.exe" "@obj\Debug\Npgsqlccrefgen.rsp"" exited with code 1.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

Small repo project would be helpful!

from codecontracts.

roji avatar roji commented on August 17, 2024

I'd love to help, but the stack trace gives no indication at all of where the error is coming from... Do you have some method/pattern of isolation in this case? Or should I simply attempt to cut out code until I manage to isolate?

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

What version are you using? Can you try new release? This one: https://github.com/Microsoft/CodeContracts/releases/tag/v.1.9.10709.0

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

Trying to reproduce and test the fix.

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

I tried to create simple console application and added a dependency to Npgsql. Added new Npgsql.NpgsqlConnection() but was able to compile this using latest version...

Should I do something else?

from codecontracts.

roji avatar roji commented on August 17, 2024

@SergeyTeplyakov, am using the new version just published (v.1.9.10709.0). Sorry for not being clearer, but the error happens when compiling the project, not when running anything. So just clone the develop branch of Npgsql and try to compile it in VS2015 and you should get the error.

I could go eliminating Contract.Requires/Contract.Ensures until the error is gone, this way we isolate the issue - do you have a better idea?

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

No need to remove anything. There is a fix that I didn't apply - #33. So I'll try to apply it locally and then will check is it fixed or not.

from codecontracts.

roji avatar roji commented on August 17, 2024

OK great @SergeyTeplyakov, I'll look out for a new version. Let me know if there's anything else I can help with on this.

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

Thanks, @roji! I'll push an update soon if the fix will solve the issue.

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

Could you please backup your old Contract folder (Program Files x86\Microsoft\Contracts\bin) and unzip this (http://files.rsdn.ru/34036/ccrefgen.zip) new ccrefgen version there. Could you please check it?

from codecontracts.

roji avatar roji commented on August 17, 2024

Hmm, I no longer get the previous issue but I do get some new, async-related ones:

Severity    Code    Description Project File    Line
Error   CC1017  Malformed contract section in method 'Npgsql.NpgsqlBuffer+<SkipAsync>d__78.MoveNext'    Npgsql  C:\projects\npgsql\src\Npgsql\NpgsqlBuffer.cs   600
Error   CC1017  Malformed contract section in method 'Npgsql.NpgsqlDataReader+<GetFieldValueInternalAsync>d__133`1.MoveNext'    Npgsql  C:\projects\npgsql\src\Npgsql\NpgsqlDataReader.cs   1861
Error   CC1017  Malformed contract section in method 'Npgsql.NpgsqlLargeObjectStream+<SeekAsync>d__34.MoveNext' Npgsql  C:\projects\npgsql\src\Npgsql\NpgsqlLargeObjectStream.cs    300
Error   CC1017  Malformed contract section in method 'Npgsql.NpgsqlLargeObjectStream+<SetLengthAsync>d__36.MoveNext'    Npgsql  C:\projects\npgsql\src\Npgsql\NpgsqlLargeObjectStream.cs    300
Error       The command ""C:\Program Files (x86)\Microsoft\Contracts\Bin\ccrewrite.exe" "@Npgsqlccrewrite.rsp"" exited with code 4. Npgsql      

Note that the files and line numbers are bogus: these async methods are in GeneratedAsync.cs (there's some code generation going on). In any case, the first methods is simply this:

        internal async Task SkipAsync(long len)
        {
            Contract.Requires(len >= 0);
            if (len > ReadBytesLeft)
            {
                len -= ReadBytesLeft;
                while (len > Size)
                {
                    Clear();
                    await EnsureAsync(Size);
                    len -= Size;
                }

                Clear();
                await EnsureAsync((int)len);
            }

            ReadPosition += (int)len;
        }

Am not sure what is causing this: a simple async method with Contract.Requires seems OK... Should I open a different issue and try to isolate?

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

That's a different issue. Thanks. I'll check it. Could you create separate issue for it? And Could you comment requires in this code just to move forward and check for other patterns that could cause issues?

from codecontracts.

roji avatar roji commented on August 17, 2024

OK, opened #112.

Will check with these methods commented out and report back.

from codecontracts.

jbcutting avatar jbcutting commented on August 17, 2024

@SergeyTeplyakov - Just as an FYI, I'm seeing the same issue as roji with the preview release. With your modified ccrefgen from this thread, the errors go away. I'll try out the next release when you get the fix incorporated. Thank you to you and @sharwell for all the hard work you've been doing!

from codecontracts.

sharwell avatar sharwell commented on August 17, 2024

The error I received when compiling my project in debug mode is the same as well. I haven't tried the fix yet.

from codecontracts.

SergeyTeplyakov avatar SergeyTeplyakov commented on August 17, 2024

Thanks, @sharwell, @jbcutting. I'm working on the fix for #112 and after that will publish a new release.

from codecontracts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.