質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Visual Studio

Microsoft Visual StudioはMicrosoftによる統合開発環境(IDE)です。多種多様なプログラミング言語に対応しています。

Q&A

2回答

298閲覧

websocket-sharpのビルド

miiichat

総合スコア72

Visual Studio

Microsoft Visual StudioはMicrosoftによる統合開発環境(IDE)です。多種多様なプログラミング言語に対応しています。

0グッド

0クリップ

投稿2019/06/08 15:27

こちらのサイトを参考にwebsocket-sharpのビルドをしてみましたが、うまくいかず以下のエラー
(visualstudio2017です。)

重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態 エラー CS0540 'CookieException.ISerializable.GetObjectData(SerializationInfo, StreamingContext)': 含む型は、インターフェイス 'ISerializable' を実装しません。 websocket-sharp D:\websocket-sharp-master\websocket-sharp\Net\CookieException.cs 156 アクティブ

https://github.com/sta/websocket-sharp/issues/544
調べるとISerializableの部分がエラーになってました。
あまり詳しくなくてどの部分を削除すればいいのかわかりませんでした。

回答お願いします!!

void ISerializable.GetObjectData( SerializationInfo serializationInfo, StreamingContext streamingContext ) { base.GetObjectData(serializationInfo, streamingContext); }
#region License /* * CookieException.cs * * This code is derived from CookieException.cs (System.Net) of Mono * (http://www.mono-project.com). * * The MIT License * * Copyright (c) 2012-2019 sta.blockhead * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #endregion #region Authors /* * Authors: * - Lawrence Pit <loz@cable.a2000.nl> */ #endregion using System; using System.Runtime.Serialization; using System.Security.Permissions; namespace WebSocketSharp.Net { /// <summary> /// The exception that is thrown when a <see cref="Cookie"/> gets an error. /// </summary> [Serializable] public class CookieException : FormatException { #region Internal Constructors internal CookieException (string message) : base (message) { } internal CookieException (string message, Exception innerException) : base (message, innerException) { } #endregion #region Protected Constructors /// <summary> /// Initializes a new instance of the <see cref="CookieException"/> class /// with the serialized data. /// </summary> /// <param name="serializationInfo"> /// A <see cref="SerializationInfo"/> that holds the serialized object data. /// </param> /// <param name="streamingContext"> /// A <see cref="StreamingContext"/> that specifies the source for /// the deserialization. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="serializationInfo"/> is <see langword="null"/>. /// </exception> protected CookieException ( SerializationInfo serializationInfo, StreamingContext streamingContext ) : base (serializationInfo, streamingContext) { } #endregion #region Public Constructors /// <summary> /// Initializes a new instance of the <see cref="CookieException"/> class. /// </summary> public CookieException () : base () { } #endregion #region Public Methods /// <summary> /// Populates the specified <see cref="SerializationInfo"/> instance with /// the data needed to serialize the current instance. /// </summary> /// <param name="serializationInfo"> /// A <see cref="SerializationInfo"/> that holds the serialized object data. /// </param> /// <param name="streamingContext"> /// A <see cref="StreamingContext"/> that specifies the destination for /// the serialization. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="serializationInfo"/> is <see langword="null"/>. /// </exception> [ SecurityPermission ( SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter ) ] public override void GetObjectData ( SerializationInfo serializationInfo, StreamingContext streamingContext ) { base.GetObjectData (serializationInfo, streamingContext); } #endregion #region Explicit Interface Implementation /// <summary> /// Populates the specified <see cref="SerializationInfo"/> instance with /// the data needed to serialize the current instance. /// </summary> /// <param name="serializationInfo"> /// A <see cref="SerializationInfo"/> that holds the serialized object data. /// </param> /// <param name="streamingContext"> /// A <see cref="StreamingContext"/> that specifies the destination for /// the serialization. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="serializationInfo"/> is <see langword="null"/>. /// </exception> [ SecurityPermission ( SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter, SerializationFormatter = true ) ] void ISerializable.GetObjectData( SerializationInfo serializationInfo, StreamingContext streamingContext ) { base.GetObjectData(serializationInfo, streamingContext); } #endregion } }

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

もう遅いかもしれませんが、
クラスのところを
public class CookieException : FormatException, ISerializable
に置き換えると、エラー吐かないです!

投稿2019/07/16 07:35

Sotone_x_Nakane

総合スコア26

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

一般論としての回答ですが、オープンソースのもので既知のバグがある場合、「正しい修正方法」がわかる人がいればプルリクエストを投げて修正しますので、修正されるまで待つのが得策です。

それが無理なのであれば、エラーの出ないコミットまで遡ってソースを取得しましょう(この意味がわからないようであればソースをいじるのは辛いと思います)

ソースを直接いじるにはそれなりの知識が必要なので、よくわからずとにかく「ビルドエラーが出ない」ようにしても正しく動くとは限りませんので、場当たり的な対処はしない方が良いです。

投稿2019/06/09 00:11

gentaro

総合スコア8949

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問